Class: PhlexKit::ComboboxList

Inherits:
BaseComponent show all
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

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ ComboboxList

Returns a new instance of ComboboxList.



6
7
8
# File 'app/components/phlex_kit/combobox/combobox_list.rb', line 6

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

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
# File 'app/components/phlex_kit/combobox/combobox_list.rb', line 10

def view_template(&)
  div(**mix({
    id: "pk-combobox-list-#{SecureRandom.hex(4)}",
    class: "pk-combobox-list",
    role: "listbox",
    data: { phlex_kit__combobox_target: "list" }
  }, @attrs), &)
end