Class: PhlexKit::ComboboxItem
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::ComboboxItem
- Defined in:
- app/components/phlex_kit/combobox/combobox_item.rb
Overview
One option row — a
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ ComboboxItem
constructor
A new instance of ComboboxItem.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(**attrs) ⇒ ComboboxItem
Returns a new instance of ComboboxItem.
9 10 11 |
# File 'app/components/phlex_kit/combobox/combobox_item.rb', line 9 def initialize(**attrs) @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/components/phlex_kit/combobox/combobox_item.rb', line 13 def view_template(&) base = { class: "pk-combobox-item", data: { phlex_kit__combobox_target: "item" } } # Defaults only when the caller didn't supply their own — `mix` fuses # (a server-rendered initially-selected option sets its own selected). base[:role] = "option" unless attr_set?(:role) base[:aria] = { selected: "false" } unless aria_key_set?(:selected) label(**mix(base, @attrs), &) end |