Class: PhlexKit::DropdownMenuRadioGroup

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/phlex_kit/dropdown_menu/dropdown_menu_radio_group.rb

Overview

Exclusive-choice group of DropdownMenuRadioItems (share the same name:). Ported from shadcn/ui's DropdownMenuRadioGroup. See dropdown_menu.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ DropdownMenuRadioGroup

Returns a new instance of DropdownMenuRadioGroup.



5
# File 'app/components/phlex_kit/dropdown_menu/dropdown_menu_radio_group.rb', line 5

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

Instance Method Details

#view_templateObject



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

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