Class: PhlexKit::ComboboxListGroup

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/combobox/combobox_list_group.rb

Overview

Labelled option group. Pass label: — it renders as aria-label (a bare label attribute is invalid on

and silent to AT) plus data-label, which CSS renders via ::before content(attr(data-label)). The group auto-hides (pure CSS :has) when filtering leaves it with no visible items. See combobox.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(label: nil, **attrs) ⇒ ComboboxListGroup

Returns a new instance of ComboboxListGroup.



8
9
10
11
# File 'app/components/phlex_kit/combobox/combobox_list_group.rb', line 8

def initialize(label: nil, **attrs)
  @label = label
  @attrs = attrs
end

Instance Method Details

#view_templateObject



13
14
15
16
17
18
19
20
# File 'app/components/phlex_kit/combobox/combobox_list_group.rb', line 13

def view_template(&)
  div(**mix({
    class: "pk-combobox-group",
    role: "group",
    aria: { label: @label },
    data: { label: @label }
  }, @attrs), &)
end