bootstrap_form
bootstrap_form copied to clipboard
Possible to style checkboxes / radios as buttons?
Is there an easy way to implement the snippit mentioned here about radio buttons: http://getbootstrap.com/javascript/#buttons
I have my radio's defined, but I cant seem to access the class of the label that surrounds the radio button input.
@cdekker Right now we don't support this sort of thing, but it looks useful as I've written my own set of controls like this and Bootstrap's are so much simpler. I was trying to hack around the library and this is the best I can come up with right now (basically just skipping our library altogether):
<%= f.form_group do %>
<%= f.errors_on :misc %>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<%= f.radio_button_without_bootstrap :misc, "option1" %> Option 1
</label>
<label class="btn btn-primary">
<%= f.radio_button_without_bootstrap :misc, "option2" %> Option 2
</label>
<label class="btn btn-primary">
<%= f.radio_button_without_bootstrap :misc, "option3" %> Option 3
</label>
</div>
<% end %>
:+1: This features could be very useful.
Did you plan when you'll add this to your lib?
Thanks.
I guess this is the wanted feature: https://getbootstrap.com/docs/5.3/forms/checks-radios/#toggle-buttons