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="kRGwh7vODlGNg4Qrpu8ORAqJiGiGiQfoqmgO3dZJw5T1zTNuX55FVExa5LJgJGIg7l_xW3-I4Vtulq0qTKOQhw" 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 |
---|---|---|
— |
|
|
— |
|
|
— |
|