Class: Shadcn::Tooltip::Trigger::Component

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

Overview

TooltipTrigger — opens on hover and on keyboard focus.

Constant Summary

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

#call, #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

#element_attributes(**defaults) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'app/components/shadcn/tooltip/trigger/component.rb', line 11

def element_attributes(**defaults)
  super(**{
    type: "button",
    "data-state" => "closed",
    "data-shadcn--tooltip-target" => "trigger",
    "data-action" => "mouseenter->shadcn--tooltip#show " \
                     "mouseleave->shadcn--tooltip#hide " \
                     "focus->shadcn--tooltip#show " \
                     "blur->shadcn--tooltip#hide"
  }.merge(defaults))
end