Class: ShadcnPhlexcomponents::HoverCard
- Inherits:
-
Base
- Object
- Phlex::HTML
- Base
- ShadcnPhlexcomponents::HoverCard
show all
- Defined in:
- lib/shadcn_phlexcomponents/components/hover_card.rb
Constant Summary
Constants inherited
from Base
Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER
Instance Method Summary
collapse
Methods inherited from Base
#before_template, #convert_collection_hash_to_struct, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child
Constructor Details
#initialize(open: false, **attributes) ⇒ HoverCard
Returns a new instance of HoverCard.
14
15
16
17
|
# File 'lib/shadcn_phlexcomponents/components/hover_card.rb', line 14
def initialize(open: false, **attributes)
@open = open
super(**attributes)
end
|
Instance Method Details
#content(**attributes) ⇒ Object
19
20
21
|
# File 'lib/shadcn_phlexcomponents/components/hover_card.rb', line 19
def content(**attributes, &)
HoverCardContent(**attributes, &)
end
|
#default_attributes ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/shadcn_phlexcomponents/components/hover_card.rb', line 27
def default_attributes
{
data: {
controller: "hover-card",
hover_card_is_open_value: @open.to_s,
},
}
end
|
#trigger(**attributes) ⇒ Object
23
24
25
|
# File 'lib/shadcn_phlexcomponents/components/hover_card.rb', line 23
def trigger(**attributes, &)
HoverCardTrigger(**attributes, &)
end
|
#view_template ⇒ Object
36
37
38
|
# File 'lib/shadcn_phlexcomponents/components/hover_card.rb', line 36
def view_template(&)
div(**@attributes, &)
end
|