Horizontal Form

<%= form_with_source do %> <%= bootstrap_form_with model: @user, layout: :horizontal, local: true do |form| %> <%= form.email_field :email, placeholder: "Enter Email", label: "Email address", help: "We'll never share your email with anyone else" %> <%= form.password_field :password, placeholder: "Password" %> <%= form.select :status, [['activated', 1], ['blocked', 2]], prompt: "Please Select" %> <%= form.text_area :misc %> <%= form.check_box :terms, label: "Agree to Terms" %> <%= form.collection_check_boxes :misc, @collection, :id, :street %> <%= form.collection_radio_buttons :misc, @collection, :id, :street %> <%= form.file_field :misc %> <%= form.datetime_select :misc, include_blank: true %> <%= form.submit %> <% end %> <% end %>

With Validation Error

<%= form_with_source do %> <%= bootstrap_form_for @user_with_error, layout: :horizontal do |form| %> <%= form.alert_message "This is an alert" %> <%= form.error_summary %> <%= form.email_field :email, placeholder: "Enter Email", label: "Email address", help: "We'll never share your email with anyone else" %> <%= form.collection_check_boxes :misc, @collection, :id, :street %> <%= form.submit %> <% end %> <% end %>

Inline Form

<%= form_with_source do %> <%= bootstrap_form_for @user, layout: :inline do |form| %> <%= form.email_field :email, placeholder: "Enter Email", label: "Email address", help: "We'll never share your email with anyone else" %> <%= form.password_field :password, placeholder: "Password" %> <%= form.check_box :terms, label: "Agree to Terms" %> <%= form.collection_check_boxes :misc, @collection, :id, :street %> <%= form.submit %> <% end %> <% end %>

Simple Action Text Example

<%= form_with_source do %> <%= bootstrap_form_for @user, url: "/" do |form| %> <%= form.email_field :email, placeholder: "Enter Email", label: "Email address", help: "We'll never share your email with anyone else" %> <%= form.password_field :password, placeholder: "Password" %> <%= form.check_box :terms, label: "Agree to Terms" %> <%= form.collection_check_boxes :misc, @collection, :id, :street %> <%= form.rich_text_area(:life_story) if Rails::VERSION::STRING > "6" %> <%= form.submit %> <% end %> <% end %>

Floating Labels

<%= form_with_source do %> <%= bootstrap_form_for @user do |form| %> <%= form.email_field :email, placeholder: "Enter Email", label: "Email address", help: "We'll never share your email with anyone else", floating: true %> <%= form.password_field :password, placeholder: "Password", floating: true %> <%= form.text_field :misc, floating: true %> <%= form.text_area :comments, floating: true %> <%= form.select :status, [["Active", 1], ["Inactive", 2]], include_blank: "Select a value", floating: true %> <%= form.submit %> <% end %> <% end %>