# Template Form - a Rails form builder where you bring your own HTML Template Form makes defining the HTML your form inputs generate as simple as possible: you just write it out. Most other form builders, e.g. Simple Form, add a layer of indirection and make you use their own DSL. Templates are grouped so you can for example define both vertical and horizontal forms, or Bootstrap and Tailwind forms, in the same Rails app. Right now Template Form includes templates for [Bulma](https://bulma.io/documentation/form/) but in time it will include templates for all the popular CSS frameworks. Template Form works with all template engines supported by [Tilt](https://github.com/rtomayko/tilt). ### Installation Add it to your Gemfile: ``` gem 'template_form' ``` And then `bundle install`. ### Example Let's say you use Bulma. Here's what your view might look like: ```erb <%= template_form_with model: Post.new do |f| %> <%= f.input :title %> <%= f.input :body %> <% end %> ``` This will be rendered as: ```html
``` Now let's say you want a horizontal form instead. The only change you need to make is to specify the form type: ```diff - <%= template_form_with model: Post.new do |f| %> + <%= template_form_with model: Post.new, form_type: :bulma_horizontal do |f| %> ``` And then you will get this HTML instead: ```html ``` ### Defining your templates Your templates live at `/app/forms/