Reputation: 1
I have the following HTML input field:
<input type="text" class="login-field" value="" placeholder="Enter your name" id="login-name" />
<label class="login-field-icon fui-user" for="login-name"></label>
I want to translate it into my simple_form
field so it will have the same properties like classes, id's etc.
<%= f.input :email%>
Is there a way to add HTML properties inside the simple_form
field?
Upvotes: 0
Views: 945
Reputation: 2469
Extracted from simple_form documentation on Github:
<%= simple_form_for @user do |f| %>
<%= f.input :username, label: 'Your username please' %>
<%= f.input :password, hint: 'No special characters.' %>
<%= f.input :email, placeholder: '[email protected]' %>
<%= f.input :remember_me, inline_label: 'Yes, remember me' %>
<%= f.button :submit %>
<% end %>
By default it contains labels
.
Also, specific options in input call will overwrite the defaults:
<%= f.input :username, input_html: { class: 'special' } %>
Have a look at their Github page, everything is there.
Upvotes: 1