Ask A Question

Notifications

You’re not receiving notifications from this thread.

Simple Form - Make label appear after input

Michael Victor asked in Gems / Libraries

I have a simple form tag as given below:

= f.input :email, required: true, input_html: {class: 'md-input'}, wrapper_html: {class: 'md-form-group float-lable'}
and it generates the below HTML

* Email

How can I adjust the Simple Form tag such that the label element appears after the input element?

I've tried inline_label but that didn't seem to work as it was not intended for this purpose anyways

Reply

You might just need to add a float: right to the label with some CSS which may do the trick.

The other alternative I can think of would be to just mix and match your simple form and normal form html tags. I usually do this when I want most of a form to be simple form styled but one field needs to be custom. It's usually easiest to just write up the form html like I would with a regular form_for and simple_form will let you mix and match like that. That could be another approach that would do the trick.

Reply

I think that makes sense and a good approach - to mix and match! It worked for me in this case!

Thanks!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.