Class: PhlexKit::ComboboxCheckbox

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

Overview

Multi-select input inside a PhlexKit::ComboboxItem. A real checkbox (pass name:/value:/checked:), so the selection submits with the form. See combobox.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ ComboboxCheckbox

Returns a new instance of ComboboxCheckbox.



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

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

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/components/phlex_kit/combobox/combobox_checkbox.rb', line 10

def view_template
  input(**mix({
    type: :checkbox,
    # The option label is the interactive surface (ARIA option); the real
    # input must not be a second tab stop inside it.
    tabindex: "-1",
    class: "pk-combobox-checkbox",
    data: {
      phlex_kit__combobox_target: "input",
      action: "phlex-kit--combobox#inputChanged"
    }
  }, @attrs))
end