Skip to main content

This is a guide on using the GOV.UK Design System Form Builder

  1. Index
  2. Configuration

Configuration

The form builder’s defaults follow the guidance specified in the GOV.UK Design System documentation, but every project is different and having to repeatedly override settings would soon become annoying.

To configure the builder for your project, just create an initialiser in config/initializers/govuk_design_system_formbuilder.rb.

GOVUKDesignSystemFormBuilder.configure do |conf|
  conf.default_submit_button_text   = 'Apply'                       # Continue
  conf.default_error_summary_title  = 'Uh-oh, spaghettios'          # There is a problem
  conf.default_legend_tag           = 'h3'                          # h1
  conf.default_legend_size          = 'l'                           # m
  conf.default_radio_divider_text   = 'how about'                   # or

  # localisation settings
  conf.localisation_schema_fallback = %i(myapp helpers __context__)
  conf.localisation_schema_label    = nil
  conf.localisation_schema_hint     = %i(myapp descriptions __context__)
  conf.localisation_schema_legend   = %i(myapp descriptions __context__)
end

For a full list and description of configuration options check the documentation and for more information on setting up localisations for your application, there’s a dedicated page in this guide.

If there are any settings you’d like to be able to set defaults for but can’t, raise an issue.