Class: PhlexKit::DataTableExpandToggle
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::DataTableExpandToggle
- Defined in:
- app/components/phlex_kit/data_table/data_table_expand_toggle.rb
Overview
Chevron button toggling a row-detail element (pass its id as controls:);
the chevron rotates via [aria-expanded] CSS. See data_table.rb.
Instance Method Summary collapse
-
#initialize(controls:, expanded: false, label: "Toggle row details", **attrs) ⇒ DataTableExpandToggle
constructor
A new instance of DataTableExpandToggle.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(controls:, expanded: false, label: "Toggle row details", **attrs) ⇒ DataTableExpandToggle
Returns a new instance of DataTableExpandToggle.
5 6 7 8 9 10 |
# File 'app/components/phlex_kit/data_table/data_table_expand_toggle.rb', line 5 def initialize(controls:, expanded: false, label: "Toggle row details", **attrs) @controls = controls @expanded = @label = label @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/components/phlex_kit/data_table/data_table_expand_toggle.rb', line 12 def view_template (**mix({ type: :button, class: "pk-data-table-expand-toggle", aria: { expanded: @expanded.to_s, controls: @controls, label: @label }, data: { action: "click->phlex-kit--data-table#toggleRowDetail" } }, @attrs)) do icon end end |