lundi 30 novembre 2015

How to add a label on the checkbox simple_form and style the label inline to the checkbox?

I have a checkbox which doesn't have a label. How do I add a label tag in simple_form where the checkbox is inserted in the HTML label tag.

I currently have checkbox and plain text after it.

    <%= f.check_box :is_positive, as: :boolean, checked_value: true, unchecked_value: false %> Is positive?

I tried the below code, but it makes the label higher than the actual checkbox.

    <%= f.input :is_positive, as: :boolean, checked_value: true, unchecked_value: false, inline_label: 'Is positive?' %>

Is there a way to label the checkbox and have its label inline to the checkbox?




Aucun commentaire:

Enregistrer un commentaire