Class: Shadcn::Tooltip::Content::Component

Inherits:
ApplicationViewComponent show all
Defined in:
app/components/shadcn/tooltip/content/component.rb

Overview

TooltipContent — includes the rotated square Radix renders as the arrow.

Constant Summary collapse

ARROW_CLASSES =
"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 " \
"rounded-[2px] bg-foreground fill-foreground"

Constants inherited from ApplicationViewComponent

ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS

Instance Attribute Summary

Attributes inherited from ApplicationViewComponent

#attributes

Instance Method Summary collapse

Methods inherited from ApplicationViewComponent

#css_classes, default_tag, #initialize, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name

Constructor Details

This class inherits a constructor from Shadcn::ApplicationViewComponent

Instance Method Details

#callObject



33
34
35
# File 'app/components/shadcn/tooltip/content/component.rb', line 33

def call
  render_element(body: safe_join([ content, arrow ]))
end

#element_attributes(**defaults) ⇒ Object



24
25
26
27
28
29
30
31
# File 'app/components/shadcn/tooltip/content/component.rb', line 24

def element_attributes(**defaults)
  super(**{
    role: "tooltip",
    "data-state" => "closed",
    hidden: true,
    "data-shadcn--tooltip-target" => "content"
  }.merge(defaults))
end