Class: PhlexKit::MenubarRadioGroup

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/menubar/menubar_radio_group.rb

Overview

Exclusive-choice group of MenubarRadioItems (share the same name:). Mirrors shadcn/ui's MenubarRadioGroup. role="group" (NOT "radiogroup"): radiogroup may not own menuitemradio children (axe aria-required-children). See menubar.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ MenubarRadioGroup

Returns a new instance of MenubarRadioGroup.



7
# File 'app/components/phlex_kit/menubar/menubar_radio_group.rb', line 7

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

Instance Method Details

#view_templateObject



8
9
10
11
12
13
# File 'app/components/phlex_kit/menubar/menubar_radio_group.rb', line 8

def view_template(&)
  base = { class: "pk-menubar-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