Class: PhlexKit::ComboboxList
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::ComboboxList
- Defined in:
- app/components/phlex_kit/combobox/combobox_list.rb
Overview
Scrollable option list in a PhlexKit::ComboboxPopover. Carries the listbox role and an id the controller points the combobox element's aria-controls at (and derives option ids from). See combobox.rb.
Instance Method Summary collapse
-
#initialize(id: nil, **attrs) ⇒ ComboboxList
constructor
id: is a named kwarg (not left in **attrs) because
mixwould merge a caller id with the generated one into an invalid two-token id, breaking aria-controls (the documented list_id: wiring) and derived option ids. - #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(id: nil, **attrs) ⇒ ComboboxList
id: is a named kwarg (not left in **attrs) because mix would merge a
caller id with the generated one into an invalid two-token id, breaking
aria-controls (the documented list_id: wiring) and derived option ids.
9 10 11 12 |
# File 'app/components/phlex_kit/combobox/combobox_list.rb', line 9 def initialize(id: nil, **attrs) @id = id || "pk-combobox-list-#{SecureRandom.hex(4)}" @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/components/phlex_kit/combobox/combobox_list.rb', line 14 def view_template(&) div(**mix({ id: @id, class: "pk-combobox-list", role: "listbox", data: { phlex_kit__combobox_target: "list" } }, @attrs), &) end |