SimpleForm 2.0 and Twitter Bootstrap sample application.

Here you'll see the usage of SimpleForm and the Twitter Bootstrap toolkit on a Rails 3.2 application.

You can check the source code on GitHub.

New article Inline Form

toggle code examples for each form element. toggle between vertical and horizontal form
# If you generated the SimpleForm configuration with `--bootstrap`, the `simple_form_for` helper will use the bootstrap wrapper by default.
simple_form_for(@article, :html => { :class => 'form-horizontal' }) do |f|
Article

add your article title here

  # You can use the same `span*` classes from the grid system.
  f.input :name, :input_html => { :class => "span6" }, :hint => "add your article title here"
Name
  # Use different wrappers to use other elements from Bootstrap, like a 'prepend' box.
  f.input :name, :wrapper => :prepend, :label => false do
    content_tag :span, "Name", :class => "add-on"
    f.input_field :name
  end
  f.input :published, :as => :boolean
  f.input :content_type, :collection => content_type_options, :as => :check_boxes
  f.input :content_type, :collection => content_type_options, :as => :check_boxes, :item_wrapper_class => 'inline'
  f.input :content_type, :collection => content_type_options, :as => :radio_buttons
  f.input :content_type, :collection => content_type_options, :as => :radio_buttons, :item_wrapper_class => 'inline'

multiple select

  f.input :content_type, :collection => content_type_options, :input_html => { :multiple => true }
  f.input :category, :collection => content_type_options, :hint => "simple select box"
  f.input :content, :input_html => { :class => "span6" }

an example of disabled input

  f.input :disabled_text, :disabled => true, :hint => "an example of disabled input"
This is the hint text
f.input :disabled_text, :wrapper => :prepend, :hint => "This is the hint text" do
  content_tag :span, :class => "add-on" do
    check_box_tag :remove, 'true'
  end
  f.input_field :disabled_text
end
This is the hint text
  # Use the 'append' wrapper the same way as the 'prepend' one.
  f.input :disabled_text, :wrapper => :append, :hint => "This is the hint text" do
    f.input_field :disabled_text, :class => :mini
    content_tag :span, :class => "add-on active" do
      check_box_tag :remove, 'true'
    end
  end
  # SimpleForm buttons already receive the 'btn' class for Bootstrap.
  f.button :submit, :class => 'btn-primary'
  submit_tag 'Cancel', :type => :reset, :class => "btn btn-danger"