x
1
<label class="rpf-input-radio"><input name="language" type="radio" value="ruby">Ruby</label>
1
2
3
4
modifiers = [disabled ? :disabled : nil, full_width ? :'full-width' : nil].compactvalue = 'ruby'render DesignSystem::Form::RadioInputComponent.new(value:, label:, checked: false, modifiers:, name: 'language')
Radio Input Component
DesignSystem::Form::RadioInputComponent.new(label:, value:, name:, checked: false, modifiers: [])
A single radio input, complete with label.
e.g.
DesignSystem::Form::RadioInputComponent.new(label: 'Ruby', value: 'ruby', name: 'language')
would render:
<label class="rpf-input-radio"> <input name="language" type="radio" value="ruby"> Ruby</label>
Parameters
label
- The text to display next to the radiovalue
- Set the checked valuchecked
- Set the checked state, defaults tofalse
modifiers
- Additional classes to apply to the radio, e.g.:disabled
,:'full-width'
It also takes the normal HTML attributes for a radio input, such as name
and id
.
The label
parameter can also replaced with block, allowing for more complex labels.
<%= DesignSystem::Form::RadioInputComponent.new(name: 'language', value: 'ruby') do %> <strong>Some different</strong> label text.<% end %>
If no label is provided, the radio will not be rendered.
Param | Description | Input |
---|---|---|
— |
|
|
— |
|
|
— |
|