Class: StateComponent
- Defined in:
- app/components/state_component.rb
Overview
State — UI state management for elements.
Usage:
State(text_active: "Following", text_inactive: "Follow") {
Button { text "Follow" }
}
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
Methods inherited from Component
default, #initialize, #render_in, slot
Constructor Details
This class inherits a constructor from Component
Instance Method Details
#to_s ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/components/state_component.rb', line 16 def to_s data = { controller: "fui-state" } data[:fui_state_text_active_value] = text_active if text_active data[:fui_state_text_inactive_value] = text_inactive if text_inactive data[:fui_state_class_active_value] = class_active if class_active data[:fui_state_class_inactive_value] = class_inactive if class_inactive tag.div(data: data) { @content } end |