Class: PhlexKit::DropdownMenuGroup

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

Overview

Grouping wrapper for related items (with an optional leading DropdownMenuLabel). Ported from shadcn/ui's DropdownMenuGroup. See dropdown_menu.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ DropdownMenuGroup

Returns a new instance of DropdownMenuGroup.



6
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_group.rb', line 6

def initialize(**attrs) = (@attrs = attrs)

Instance Method Details

#view_templateObject



7
8
9
10
11
12
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_group.rb', line 7

def view_template(&)
  base = { class: "pk-dropdown-menu-group" }
  # Default only when the caller didn't supply their own — `mix` fuses.
  base[:role] = "group" unless attr_set?(:role)
  div(**mix(base, @attrs), &)
end