x
1
2
3
4
<form class="new_person" id="new_person" action="#" accept-charset="UTF-8" method="post"><input type="hidden" name="authenticity_token" value="tmzXRgRhkGVVixuwyI-jPQjQC0v5z6V2R4VgISekmPgVJwHjGW0If8xSD6P2EvLG4PRj11-H8_bJOi20wdldcg" autocomplete="off" /><label class="rpf-input-checkbox"><input type="hidden" value="0" name="person[likes_cheese]"><input id="person_likes_cheese" name="person[likes_cheese]" type="checkbox" value="1"> Do you <strong>really</strong> like cheese?</label></form>1
2
3
4
5
<%= form_for model, url: '#', builder: DesignSystem::FormBuilder do |f| %> <%= f.rpf_checkbox_input :likes_cheese, modifiers:, **attrs do %> Do you <strong>really</strong> like cheese? <% end %><% end %>Checkbox Input Component (with content)
The checkbox compoenent can accept a block which will be used as the label.
<%= form_for @person, url: '#', builder: DesignSystem::FormBuilder do |f| %> <%= f.rpf_checkbox_input :accepts_terms do %> I <strong>do</strong> accept the terms <% end %><% end %>produces:
<!-- form opening tag goes here ---><label class="rpf-input-checkbox"> <input name="person[accepts_terms]" type="hidden" value="0> <input id="person_accepts_terms" name="person[accepts_terms]" type="checkbox" value="1"> I <strong>do</strong> accept the terms</label>This example uses a model, but the same applies without a model.
| Param | Description | Input |
|---|---|---|
|
— |
|
|
|
— |
|
|
|
— |
|