Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Add space to checkboxes and radio buttons #492

ryanb opened this Issue · 5 comments

2 participants


When using a collection with checkboxes or radio buttons, there is no space between the checkbox/radio button and the label. But there is a space for a boolean attribute checkbox. I think a space should be added to the collections to make it consistent with boolean attributes.


Hey Ryan. Are you using it with :nested or :inline option? Cloud you send us the generated HTML?



It is the default after running rails g simple_form:install, which is :nested. Here are two lines from the HTML source. The first one being part of a boolean attribute, the second one being part of a collection.

<label class="boolean optional control-label checkbox" for="product_discontinued"><input class="boolean optional" id="product_discontinued" name="product[discontinued]" type="checkbox" value="1" /> Discontinued</label>
<label class="checkbox"><input checked="checked" class="check_boxes optional" id="product_category_ids_4" name="product[category_ids][]" type="checkbox" value="4" />Strategy</label>

Notice no space in the second one.


I saw the source of this behavior.

When you use the :boolean input the SimpleForm use the label_text lambda to generate the label text. By default the label_text is "#{required} #{label}". Inside the BooleanInput required is always false so the label_text output will always have a whitespace before. If someone change the label_text lambda to "#{label} #{required}" the whitespace will be after the text, so changing the collection helpers to add the whitespace will not be easy.

I can fix this issue easily removing the whitespace in all the checkboxes radio buttons inputs. Do you think that this is enough?

@rafaelfranca rafaelfranca was assigned

I think having any kind of consistency here would be a good thing, whether it be a space or not a space. Padding can always be added through CSS once things are consistent.


Fixed. Thanks to report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.