Class: PhlexKit::PopoverContent
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::PopoverContent
- Defined in:
- app/components/phlex_kit/popover/popover_content.rb
Overview
The floating panel of a PhlexKit::Popover. align: :end flips it to the
trigger's end edge (their align prop). See popover.rb.
Constant Summary collapse
- ALIGNS =
{ start: nil, end: "end" }.freeze
Instance Method Summary collapse
-
#initialize(align: :start, **attrs) ⇒ PopoverContent
constructor
A new instance of PopoverContent.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(align: :start, **attrs) ⇒ PopoverContent
Returns a new instance of PopoverContent.
7 8 9 10 |
# File 'app/components/phlex_kit/popover/popover_content.rb', line 7 def initialize(align: :start, **attrs) @align = align.to_sym @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
12 13 14 15 |
# File 'app/components/phlex_kit/popover/popover_content.rb', line 12 def view_template(&) classes = [ "pk-popover-content", "pk-hidden", ALIGNS.fetch(@align) ].compact.join(" ") div(**mix({ class: classes, data: { phlex_kit__popover_target: "content", state: "closed" } }, @attrs), &) end |