Class: ShadcnPhlexcomponents::PopoverContent
- Defined in:
- lib/shadcn_phlexcomponents/components/popover.rb
Constant Summary
Constants inherited from Base
Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER
Instance Method Summary collapse
- #default_attributes ⇒ Object
-
#initialize(side: :bottom, align: :center, aria_id: nil, **attributes) ⇒ PopoverContent
constructor
A new instance of PopoverContent.
- #view_template ⇒ Object
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(side: :bottom, align: :center, aria_id: nil, **attributes) ⇒ PopoverContent
Returns a new instance of PopoverContent.
97 98 99 100 101 102 |
# File 'lib/shadcn_phlexcomponents/components/popover.rb', line 97 def initialize(side: :bottom, align: :center, aria_id: nil, **attributes) @side = side @align = align @aria_id = aria_id super(**attributes) end |
Instance Method Details
#default_attributes ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/shadcn_phlexcomponents/components/popover.rb', line 110 def default_attributes { id: "#{@aria_id}-content", tabindex: -1, role: "dialog", data: { side: @side, align: @align, popover_target: "content", action: "popover:click:outside->popover#clickOutside", }, } end |
#view_template ⇒ Object
104 105 106 107 108 |
# File 'lib/shadcn_phlexcomponents/components/popover.rb', line 104 def view_template(&) PopoverContentContainer do div(**@attributes, &) end end |