Form builder for Ruby. Fast, Furious, and Framework-Agnostic.
Framework-Agnostic Form Renderer for Ruby.
Formular renders HTML forms in a similar fashion to SimpleForm and other gems. It is lightning-fast, has zero coupling to any ORM or web framework, and makes no magical assumptions about the rendered form object.
While you can instantiate the form builder manually, it’s easiest to use the form
helper to do so. Include Formular::Helper
or in rails, Formular::RailsHelper
into your cell, view, or in a Rails controller as a helper.
module Post::Cell
class New < Cell::ViewModel
include Formular::Helper
or
class PostsController < ApplicationController
helper Formular::RailsHelper
You should also configure what builder you want to use. This will wrap inputs correctly, and so on.
Formular::Helper.builder= :bootstrap3
In your view, you’re now ready to use Formular’s API to render forms.
Our basic builder ships with the following elements:
We also provide builders for Twitter Bootstrap (v.3&4) and Zurb’s Foundation (v.6)
To help you get started we’ve got some example Sinatra apps so you can see Formular in action:
Formular’s API docs and information on how to extend it will be found on the Trailblazer project page once the page has been added 😉.
_attributes
.Add this line to your application’s Gemfile:
gem 'formular'
Requires Ruby >= 2.0.0
The gem is available as open source under the terms of the MIT License.