Skip to main content
  1. X-GOVUK projects
  2. GOV.UK Form Builder
  3. Get started

Get started

GOV.UK Form Builder is suitable for use with any Rails application that uses the GOV.UK Design System.

Every component is designed to produce accessible HTML that meets all of the design system’s requirements without having to spend time reinventing the wheel.

This tool is aimed at developers. If you want to build forms without writing code, use a service like GOV.UK Forms or MoJ Forms.

If you’re starting from scratch, the easiest way to hit the ground running is to use the DfE’s Rails template.


Once your application is working, simply add the following line to your Gemfile and run bundle install.

gem 'govuk_design_system_formbuilder'

Now we just need to tell Rails which form builder to use. We can do this globally by amending the ApplicationController.

class ApplicationController < ActionController::Base
  default_form_builder GOVUKDesignSystemFormBuilder::FormBuilder

Alternatively, if you’re not quite ready to make the full switch, you can specify the form builder on a form-by-form basis. All examples in this guide are written using Slim and ERB, but the form builder works just as well with Haml, too.

= form_for @some_object, builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f|
  = f.govuk_text_field :name
  = f.govuk_phone_field :telephone_number

If you made it this far and everything’s working, well done!