using simple_form
we can change class of a label using:
label_html => {:class => "myclass"}
but how do we do the same when dealing with checkboxes?
simple_form
assigns the default class of collection_check_boxes
Is there a way to change this default class?
If you want you can pass
new_class
to the label doing something like:The easiest way to change the label class for a checkbox is to insert the following in /config/inititializers/simple_form.rb or /config/initializers/simple_form_bootstrap.rb:
You should be able to set :input_html on your form input.
Somthing like:
ian.
To get the label class I had to get rid of the auto-generated label and write my own.
this is in rails 3 with simple form 2.1 so YMMV....
before:
after:
I wanted to give an update to this answer in case someone comes here looking for a way to do this as I did.
You can give the label a class with this option
:item_wrapper_class => 'class_goes_here'
Here is a full example: