Class: StimulusPlumbers::Components::Combobox::Option
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::Combobox::Option
- Defined in:
- lib/stimulus_plumbers/components/combobox/option.rb
Constant Summary
Constants included from Plumber::HtmlOptions
Plumber::HtmlOptions::STIMULUS_SPACEJOIN_KEYS
Instance Attribute Summary
Attributes inherited from Plumber::Base
Instance Method Summary collapse
Methods inherited from Plumber::Base
Methods included from Plumber::HtmlOptions
#merge_data_options, #merge_html_options, #merge_string_option, #normalize_part
Constructor Details
This class inherits a constructor from StimulusPlumbers::Components::Plumber::Base
Instance Method Details
#render(label:, value:, description: nil, disabled: false, selected: false) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/stimulus_plumbers/components/combobox/option.rb', line 7 def render(label:, value:, description: nil, disabled: false, selected: false) aria = { selected: selected ? "true" : "false" } aria[:disabled] = "true" if disabled template.content_tag(:li, role: "option", aria: aria, data: { value: value }) do if description template.safe_join( [ template.content_tag(:span, label), template.content_tag(:span, description) ] ) else label end end end |