Skip to main content
  1. X-GOVUK projects
  2. GOV.UK Form Builder
  3. 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.brand                        = 'swanky-new-design-system'    # govuk

  conf.default_submit_button_text   = 'Apply'                       # Continue
  conf.default_error_summary_title  = 'Uh-oh, spaghettios'          # There is a problem
  conf.default_legend_tag           = 'h3'                          # nil
  conf.default_legend_size          = 'l'                           # m
  conf.default_caption_size         = 'xl'                          # 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__)
  conf.localisation_schema_caption  = %i(myapp descriptions __context__)
end

For a full list and description of configuration options check the documentation and for an in-depth look at localising the form builder see the guide page on localisation.

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