bootstrap_form icon indicating copy to clipboard operation
bootstrap_form copied to clipboard

Possible to style checkboxes / radios as buttons?

Open cdekker opened this issue 10 years ago • 3 comments

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 avatar Aug 15 '14 00:08 cdekker

@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 %>

potenza avatar Aug 21 '14 22:08 potenza

:+1: This features could be very useful.

Did you plan when you'll add this to your lib?

Thanks.

soullivaneuh avatar Mar 30 '15 11:03 soullivaneuh

I guess this is the wanted feature: https://getbootstrap.com/docs/5.3/forms/checks-radios/#toggle-buttons

donv avatar Sep 08 '23 13:09 donv