How to edit the simple_form to customize the fields

Asked

Viewed 265 times

0

I would like to know how to edit the fields of Forms with simple_form, edit such with bootstrap, I read some tutorials but I did not understand well how to edit, how to use the class: form-control, etc.

<%= simple_form_for @admin_category, as: 'user_basic' do |f| %>
  <%= f.input  :name, label: 'Nome' %>
  <%= f.input  :active, as: :check_boxes, label: 'Ativo' %>
  <%= f.button :submit %>
<% end %>

This code is from a simple form in which I would like it to be just like the bootstrap fields, but it appears all disconfigured. Thank you for your attention!

1 answer

0

Put the input_html: { class: 'form-control' } in its input

<%= simple_form_for @admin_category, as: 'user_basic' do |f| %>
  <%= f.input  :name, label: 'Nome', input_html: { class: 'form-control', placeholder: "Nome" } %>
  <%= f.input  :active, as: :check_boxes, label: 'Ativo' %>
  <%= f.button :submit %>
<% end %>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.