Class: PhlexKit::CommandList
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::CommandList
- Defined in:
- app/components/phlex_kit/command/command_list.rb
Overview
Container for CommandGroups, with dividers between them. Carries the listbox role and an id the controller points the input's aria-controls at (and derives result ids from, for aria-activedescendant). See command.rb.
Instance Method Summary collapse
-
#initialize(id: nil, **attrs) ⇒ CommandList
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 result ids. - #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(id: nil, **attrs) ⇒ CommandList
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 result ids.
9 10 11 12 |
# File 'app/components/phlex_kit/command/command_list.rb', line 9 def initialize(id: nil, **attrs) @id = id || "pk-command-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/command/command_list.rb', line 14 def view_template(&) div(**mix({ id: @id, class: "pk-command-list", role: "listbox", data: { phlex_kit__command_target: "list" } }, @attrs), &) end |