Class: Daisy::DataInput::ToggleComponent
- Inherits:
-
CheckboxComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- CheckboxComponent
- Daisy::DataInput::ToggleComponent
- Defined in:
- app/components/daisy/data_input/toggle_component.rb
Overview
The Toggle component renders a DaisyUI styled toggle switch. It can be used standalone or with a form builder, and provides a visual way to toggle between two states (on/off).
Constant Summary
Constants inherited from LocoMotion::BaseComponent
LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS
Instance Attribute Summary
Attributes inherited from CheckboxComponent
#checked, #disabled, #id, #name, #required, #toggle, #value
Attributes inherited from LocoMotion::BaseComponent
Instance Method Summary collapse
-
#initialize(**kws) ⇒ ToggleComponent
constructor
Instantiate a new Toggle component.
Methods inherited from CheckboxComponent
#before_render, #setup_component, #setup_labels
Methods included from LocoMotion::Concerns::LabelableComponent
#before_render, #has_any_label?, #has_end_label?, #has_floating_label?, #has_start_label?
Methods inherited from LocoMotion::BaseComponent
#before_render, 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
Constructor Details
#initialize(**kws) ⇒ ToggleComponent
Instantiate a new Toggle component.
This component accepts the same options as CheckboxComponent, but always sets ‘toggle: true` to render the checkbox as a toggle switch.
42 43 44 45 46 47 |
# File 'app/components/daisy/data_input/toggle_component.rb', line 42 def initialize(**kws) # Always force toggle to be true kws[:toggle] = true super(**kws) end |