Class: Daisy::DataInput::SelectComponent::SelectOptionComponent
- Inherits:
-
LocoMotion::BasicComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- LocoMotion::BasicComponent
- Daisy::DataInput::SelectComponent::SelectOptionComponent
- Defined in:
- app/components/daisy/data_input/select_component.rb
Constant Summary
Constants inherited from LocoMotion::BaseComponent
LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS
Instance Attribute Summary collapse
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#selected ⇒ Object
readonly
Returns the value of attribute selected.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from LocoMotion::BaseComponent
Instance Method Summary collapse
-
#call ⇒ String
Renders the option element with the appropriate attributes.
-
#initialize(value:, label:, selected: false, disabled: false, css: "", html: {}, **kws) ⇒ SelectOptionComponent
constructor
Initialize a new select option component.
Methods inherited from LocoMotion::BasicComponent
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(value:, label:, selected: false, disabled: false, css: "", html: {}, **kws) ⇒ SelectOptionComponent
Initialize a new select option component.
63 64 65 66 67 68 69 70 71 |
# File 'app/components/daisy/data_input/select_component.rb', line 63 def initialize(value:, label:, selected: false, disabled: false, css: "", html: {}, **kws) @value = value @label = label @selected = selected @disabled = disabled @css = css @html = html super(**kws) end |
Instance Attribute Details
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
46 47 48 |
# File 'app/components/daisy/data_input/select_component.rb', line 46 def disabled @disabled end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
46 47 48 |
# File 'app/components/daisy/data_input/select_component.rb', line 46 def label @label end |
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
46 47 48 |
# File 'app/components/daisy/data_input/select_component.rb', line 46 def selected @selected end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
46 47 48 |
# File 'app/components/daisy/data_input/select_component.rb', line 46 def value @value end |
Instance Method Details
#call ⇒ String
Renders the option element with the appropriate attributes.
78 79 80 81 82 83 84 85 |
# File 'app/components/daisy/data_input/select_component.rb', line 78 def call content_tag(:option, label, { value: value, selected: selected, disabled: disabled, class: @css }.merge(@html)) end |