Class: PhlexKit::ComboboxTrigger
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::ComboboxTrigger
- Defined in:
- app/components/phlex_kit/combobox/combobox_trigger.rb
Overview
The closed-state button for PhlexKit::Combobox — shows the placeholder until the
controller writes the selected item text (or "N
Instance Method Summary collapse
-
#initialize(placeholder: "", **attrs) ⇒ ComboboxTrigger
constructor
A new instance of ComboboxTrigger.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(placeholder: "", **attrs) ⇒ ComboboxTrigger
Returns a new instance of ComboboxTrigger.
6 7 8 9 |
# File 'app/components/phlex_kit/combobox/combobox_trigger.rb', line 6 def initialize(placeholder: "", **attrs) @placeholder = placeholder @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/components/phlex_kit/combobox/combobox_trigger.rb', line 11 def view_template (**mix({ type: :button, class: "pk-combobox-trigger", aria: { haspopup: "listbox", expanded: "false" }, data: { placeholder: @placeholder, phlex_kit__combobox_target: "trigger", action: "phlex-kit--combobox#togglePopover" } }, @attrs)) do span(class: "pk-combobox-trigger-content", data: { phlex_kit__combobox_target: "triggerContent" }) do @placeholder end icon end end |