Class: Primer::Forms::RadioButton
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Primer::Forms::RadioButton
- Defined in:
- app/lib/primer/forms/radio_button.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(input:) ⇒ RadioButton
constructor
A new instance of RadioButton.
- #nested_form_arguments ⇒ Object
Methods inherited from BaseComponent
compile!, #content, #input?, #perform_render, #render?, #to_component, #type
Methods included from ActsAsComponent
#compile!, extended, #renders_templates
Methods included from ClassNameHelper
Constructor Details
#initialize(input:) ⇒ RadioButton
Returns a new instance of RadioButton.
9 10 11 12 13 |
# File 'app/lib/primer/forms/radio_button.rb', line 9 def initialize(input:) @input = input @input.add_label_classes("FormControl-label") @input.add_input_classes("FormControl-radio") end |
Instance Method Details
#nested_form_arguments ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/lib/primer/forms/radio_button.rb', line 15 def nested_form_arguments return @nested_form_arguments if defined?(@nested_form_arguments) @nested_form_arguments = { hidden: @input.hidden?, **@input.nested_form_arguments } @nested_form_arguments[:class] = class_names( @nested_form_arguments[:class], @nested_form_arguments.delete(:classes), "ml-4" ) @nested_form_arguments end |