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), :top (opens above — for triggers near the bottom
of the viewport, e.g. the sidebar footer), :right or :left (opens beside
the trigger — shadcn's side prop). See dropdown_menu.rb.
Constant Summary collapse
- SIDES =
{ bottom: nil, top: "pk-dropdown-menu-content-up", left: "pk-dropdown-menu-content-left", right: "pk-dropdown-menu-content-right" }.freeze
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.
10 11 12 13 |
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_content.rb', line 10 def initialize(side: :bottom, **attrs) @side = side.to_sym @attrs = attrs end |
Instance Method Details
#view_template(&block) ⇒ Object
15 16 17 18 19 |
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_content.rb', line 15 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 |