Skip to main content
Ask A Question
Notifications
You’re not receiving notifications from this thread.
Subscribe

Simple Form - Make label appear after input

Gems / Libraries • Asked by Michael Victor

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


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.


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

Thanks!


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.