Class: Daisy::Actions::SwapComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::Actions::SwapComponent
- Includes:
- LocoMotion::Concerns::TippableComponent
- Defined in:
- app/components/daisy/actions/swap_component.rb
Defined Under Namespace
Classes: SwapIndeterminate, SwapOff, SwapOn
Constant Summary
Constants inherited from LocoMotion::BaseComponent
LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS
Instance Attribute Summary collapse
-
#simple_off ⇒ String
readonly
The value of the ‘off` option.
-
#simple_on ⇒ String
readonly
The value of the ‘on` option.
Attributes inherited from LocoMotion::BaseComponent
Instance Method Summary collapse
-
#before_render ⇒ Object
Sets up the component with various CSS classes and HTML attributes.
-
#initialize(on = nil, off = nil, checked = nil, **kws, &block) ⇒ SwapComponent
constructor
Creates a new instance of the SwapComponent.
Methods inherited from LocoMotion::BaseComponent
build, #component_ref, #config_option, #cssify, define_modifier, define_modifiers, define_part, define_parts, define_size, define_sizes, #empty_part_content, #inspect, #part, register_component_initializer, register_component_setup, #rendered_css, #rendered_data, #rendered_html, #rendered_stimulus_controllers, #rendered_tag_name, renders_many, renders_one, set_component_name, #set_loco_parent, #strip_spaces
Methods included from LocoMotion::Concerns::InspectableComponent
Constructor Details
#initialize(on = nil, off = nil, checked = nil, **kws, &block) ⇒ SwapComponent
Creates a new instance of the SwapComponent.
131 132 133 134 135 136 137 |
# File 'app/components/daisy/actions/swap_component.rb', line 131 def initialize(on = nil, off = nil, checked = nil, **kws, &block) super @checked = config_option(:checked, checked || false) @simple_on = config_option(:on, on) @simple_off = config_option(:off, off) end |
Instance Attribute Details
#simple_off ⇒ String (readonly)
Returns The value of the ‘off` option. Usually text or emoji.
100 101 102 |
# File 'app/components/daisy/actions/swap_component.rb', line 100 def simple_off @simple_off end |
#simple_on ⇒ String (readonly)
Returns The value of the ‘on` option. Usually text or emoji.
97 98 99 |
# File 'app/components/daisy/actions/swap_component.rb', line 97 def simple_on @simple_on end |
Instance Method Details
#before_render ⇒ Object
Sets up the component with various CSS classes and HTML attributes.
142 143 144 145 146 147 |
# File 'app/components/daisy/actions/swap_component.rb', line 142 def before_render setup_component # Set tag, base CSS setup_checkbox # Setup the hidden checkbox part setup_on_off # Setup the on/off part CSS super # Run TippableComponent hook end |