Class: PhlexKit::DropdownMenuContent

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/dropdown_menu/dropdown_menu_content.rb

Overview

The dropdown panel. Hidden until the trigger toggles it. 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

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(side: :bottom, **attrs) ⇒ DropdownMenuContent

Returns a new instance of DropdownMenuContent.



6
7
8
9
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_content.rb', line 6

def initialize(side: :bottom, **attrs)
  @side = side.to_sym
  @attrs = attrs
end

Instance Method Details

#view_template(&block) ⇒ Object



11
12
13
14
15
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_content.rb', line 11

def view_template(&block)
  div(class: wrapper_classes, data: { phlex_kit__dropdown_menu_target: "content" }) do
    div(**mix({ class: "pk-dropdown-menu-viewport" }, @attrs), &block)
  end
end