Class: Polaris::OptionList::CheckboxComponent
- Inherits:
-
Component
- Object
- Component
- Polaris::OptionList::CheckboxComponent
- Defined in:
- app/components/polaris/option_list/checkbox_component.rb
Instance Method Summary collapse
- #checkbox ⇒ Object
-
#initialize(label:, value:, wrapper_arguments: {}, **system_arguments) ⇒ CheckboxComponent
constructor
A new instance of CheckboxComponent.
- #system_arguments ⇒ Object
- #wrapper_arguments ⇒ Object
Constructor Details
#initialize(label:, value:, wrapper_arguments: {}, **system_arguments) ⇒ CheckboxComponent
Returns a new instance of CheckboxComponent.
2 3 4 5 6 7 8 9 10 11 12 |
# File 'app/components/polaris/option_list/checkbox_component.rb', line 2 def initialize( label:, value:, wrapper_arguments: {}, **system_arguments ) @label = label @value = value @wrapper_arguments = wrapper_arguments @system_arguments = system_arguments end |
Instance Method Details
#checkbox ⇒ Object
34 35 36 |
# File 'app/components/polaris/option_list/checkbox_component.rb', line 34 def checkbox render Polaris::BaseCheckbox.new(value: @value, **system_arguments) end |
#system_arguments ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/components/polaris/option_list/checkbox_component.rb', line 25 def system_arguments @system_arguments.tap do |opts| opts[:classes] = class_names( @system_arguments[:classes], "Polaris-Checkbox__Input" ) end end |
#wrapper_arguments ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/components/polaris/option_list/checkbox_component.rb', line 14 def wrapper_arguments @wrapper_arguments.tap do |opts| opts[:tag] = "li" opts[:tabindex] = "-1" opts[:classes] = class_names( @wrapper_arguments[:classes], "Polaris-OptionList-Option" ) end end |