Class: PhlexKit::DropdownMenuContent
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::DropdownMenuContent
- Defined in:
- app/components/phlex_kit/dropdown_menu/dropdown_menu_content.rb
Overview
The dropdown panel — a native [popover=manual] the trigger toggles,
anchor-positioned with viewport-edge flipping. side: is :bottom
(default, opens below) or :top (opens above — for triggers near the bottom of
the viewport, e.g. the sidebar footer). See dropdown_menu.rb.
Instance Method Summary collapse
-
#initialize(side: :bottom, **attrs) ⇒ DropdownMenuContent
constructor
A new instance of DropdownMenuContent.
- #view_template(&block) ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(side: :bottom, **attrs) ⇒ DropdownMenuContent
Returns a new instance of DropdownMenuContent.
7 8 9 10 |
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_content.rb', line 7 def initialize(side: :bottom, **attrs) @side = side.to_sym @attrs = attrs end |
Instance Method Details
#view_template(&block) ⇒ Object
12 13 14 15 16 |
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_content.rb', line 12 def view_template(&block) div(class: wrapper_classes, popover: "manual", data: { phlex_kit__dropdown_menu_target: "content" }) do div(**mix({ class: "pk-dropdown-menu-viewport" }, @attrs), &block) end end |