Rails form builder with flexible markup and styles.
Formulate consists of a custom form builder, which builds on top of the default form builder in Rails, and a Sass stylesheet to provide some level of stylistic normalization.
FormBuilder relies on some helper methods provided by Haml, so
it will only work when used within Haml templates.
Add this line to your application's
If you want to use the Formulate's
#form_for helper by default, an engine
is provided that will override Rails' helper:
gem 'formulate', require: 'formulate/engine'
And then execute:
Or install it yourself as:
$ gem install formulate
Formulate provides a helper module that can be included in your Rails
controllers. You can also load the helper in your
use it across your whole app.
class ApplicationController < ActionController::Base helper Formulate::FormHelper end
Formulate doesn't clobber any of the built-in form builder methods, so your forms should continue to work without modification, giving you the ability to selectively begin using Formulate in your applications where you see fit.
If you're using the engine, the form builder will be used automatically
#form_for helper is called, so you don't need to do anything
special to start using it.
If you'd like to use Formulate's stylesheet, you'll need to import it into a
Sass file like
Formulate's styles are all scoped under the selector
form.formulate, so they
shouldn't clobber anything in your own applications. Basically, this just loads
a stripped down version of normalize.css with only the parts relevant to
forms. It also specifies a handful of styles to improve the vertical rhythm of
the elements generated by the form builder.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
Copyright © 2012 Tyler Hunt. See LICENSE for details.