Checkbox label on the left? #500

Closed
n8 opened this Issue Mar 4, 2012 · 15 comments

7 participants

@n8
n8 commented Mar 4, 2012

Just wanted to see if this was a bug or how it's meant to be. A single checkbox's label appears on the left of the checkbox? Isn't the convention to usually put the label on the right of any checkbox, even if it's by it's lonesome?

screenshot

@rafaelfranca

The twitter bootstrap convention is to use the label in the left side if it is only one. http://twitter.github.com/bootstrap/base-css.html#forms

@n8
n8 commented Mar 4, 2012

It is?

I see the above example in their Basic form. Only one label, and it's on the right.

There's another checkbox example where there is a label on the left but only when it's also accompanied by a label on the right too.

@rafaelfranca

You can do this markup using the :inline_label feature that will be added in the next version on SimpleForm. So by default the label will be always in the left. If you want the label in the right you will need the :inline_label option

@n8
n8 commented Mar 4, 2012

Thanks for the heads up, but for what it's worth, it is kind of confusing that it isn't the default. As I mentioned, the label on the right seems to be the normal designer's convention and bootstrap's (when there is just a single label).

@rafaelfranca rafaelfranca reopened this Mar 4, 2012
@rafaelfranca

I'll reopen it and dicuss with @carlosantoniodasilva how to solve it.

@fschwahn

You can find a solution here #424 (comment)

Maybe it just needs to be mentioned somewhere in the documentation?

@carlosantoniodasilva

@fschwahn yeah probably, but we are still thinking about how to improve this check box issue. Thanks.

@mahemoff

Related newbie question: Is there any way to show a label above the checkbox (like with other input fields)?

@carlosantoniodasilva

@mahemoff try using :boolean_style with :nested or :inline, either in the config (for all inputs) or for a single input.

@ghost

Neither of these options worked for me.

@mahemoff

@zepsolar boolean_style: :nested worked for me. Belated thanks to @carlosantoniodasilva for that.

@rafaelfranca

I think :inline_label is fine for these cases.

@rafaelfranca

inline_label is already and don't require another option to Simple Form.

Users has two options:

1.

f.input :active, inline_label: true

To render the label on the right side with the same text as the label in the left side.

2.

f.input :active, inline_label: 'Custom Label'

To render the label on the right side with a custom text.

What we can improve is when inline_label is provided we set label to false. I'll work on this.

@rafaelfranca

It was already fixed on master.

@heaven

Will this be back-ported to 2.1.1 for those who do not have ability to switch to Rails 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment