Class: Pajamas::RadioTagComponent

Inherits:
Component
  • Object
show all
Includes:
Concerns::CheckboxRadioLabelWithHelpText, Concerns::CheckboxRadioOptions
Defined in:
app/components/pajamas/radio_tag_component.rb

Instance Method Summary collapse

Methods included from Concerns::CheckboxRadioOptions

#formatted_input_options

Methods included from Concerns::CheckboxRadioLabelWithHelpText

#render_label_tag_with_help_text, #render_label_with_help_text

Constructor Details

#initialize(name:, value:, checked: false, label: nil, help_text: nil, label_options: {}, radio_options: {}) ⇒ RadioTagComponent

Returns a new instance of RadioTagComponent.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/components/pajamas/radio_tag_component.rb', line 12

def initialize(
  name:,
  value:,
  checked: false,
  label: nil,
  help_text: nil,
  label_options: {},
  radio_options: {}
)
  @name = name
  @value = value
  @checked = checked
  @label_argument = label
  @help_text_argument = help_text
  @label_options = label_options
  @label_options[:for] ||= label_for(name, value)
  @input_options = radio_options
end