Class: PhlexKit::ComboboxClearButton
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::ComboboxClearButton
- Defined in:
- app/components/phlex_kit/combobox/combobox_clear_button.rb
Overview
× button clearing the whole combobox selection — hidden until something is checked. Ported from ruby_ui's RubyUI::ComboboxClearButton; upstream referenced a clearAll action its controller never defined, so the behaviour is PhlexKit's completion of it. See combobox.rb.
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ ComboboxClearButton
constructor
A new instance of ComboboxClearButton.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(**attrs) ⇒ ComboboxClearButton
Returns a new instance of ComboboxClearButton.
7 8 9 |
# File 'app/components/phlex_kit/combobox/combobox_clear_button.rb', line 7 def initialize(**attrs) @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 28 29 30 31 32 33 34 35 36 37 |
# File 'app/components/phlex_kit/combobox/combobox_clear_button.rb', line 11 def view_template (**mix({ type: :button, class: "pk-combobox-clear-button pk-hidden", aria: { label: "Clear selection" }, data: { phlex_kit__combobox_target: "clearButton", action: "phlex-kit--combobox#clearAll" } }, @attrs)) do svg( xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewbox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" ) do |s| s.path(d: "M18 6 6 18") s.path(d: "m6 6 12 12") end end end |