Components

Checkboxes

Let users select one or more options by using the checkboxes component.

When to use this component

Use the checkboxes component when you need to help users:

  • select multiple options from a list
  • toggle a single option on or off

When not to use this component

Do not use the checkboxes component if users can only choose one option from a selection. In this case, use the radios component.

How it works

Group checkboxes together in a <fieldset> with a <legend> that describes them, as shown in the examples on this page. This is usually a question, like ‘How would you like to be contacted?’.

If you are asking just one question per page as recommended, you can set the contents of the <legend> as the page heading. This is good practice as it means that users of screen readers will only hear the contents once.

Read more about why and how to set legends as headings.

Always position checkboxes to the left of their labels. This makes them easier to find, especially for users of screen magnifiers.

Unlike with radios, users can select multiple options from a list of checkboxes. Do not assume that users will know how many options they can select based on the visual difference between radios and checkboxes alone.

If needed, add a hint explaining this, for example, ‘Select all that apply’.

Do not pre-select checkbox options as this makes it more likely that users will:

  • not realise they’ve missed a question
  • submit the wrong answer

Order checkbox options alphabetically by default.

In some cases, it can be helpful to order them from most-to-least common options. For example, you could order options for ‘What is your nationality?’ based on population size.

There are 2 ways to use the checkboxes component. You can use HTML or, if you’re using Nunjucks or the GOV.UK Prototype Kit, you can use the Nunjucks macro.

Checkbox items with hints

You can add hints to checkbox items to provide additional information about the options.

Conditionally revealing content

You can add conditionally revealing content to checkboxes, so users only see content when it’s relevant to them. For example, you could reveal a phone number input only when a user chooses to be contacted by phone.

Keep it simple - if you need to add a lot of content, consider showing it on the next page in the process instead.

Known issues

Users are not always notified when conditionally revealed content is expanded or collapsed. This fails WCAG 2.1 success criterion 4.1.2 Name, Role, Value. We plan to fix this issue by the end of March 2021.

Smaller checkboxes

Use standard-sized checkboxes in nearly all cases. However, smaller versions work well on pages where it’s helpful to make them less visually prominent.

For example, on a page of search results, the primary user need is to see the results. Using smaller checkboxes lets users see and change search filters without distracting them from the main content.

Small checkboxes can work well on information dense screens in services designed for repeat use, like caseworking systems.

In services like these, the risk that they will not be noticed is lower because users return to the screen multiple times.

Error messages

Error messages should be styled like this:

Make sure errors follow the guidance in error message and have specific error messages for specific error states.

If nothing is selected and the question has options in it

Say ‘Select if [whatever it is]’.
For example, ‘Select if you are British, Irish or a citizen of a different country’.

If nothing is selected and the question does not have options in it

Say ‘Select [whatever it is]’.
For example, ‘Select your nationality or nationalities’.

Research on this component

Read a blog post about updates to the radios and checkboxes components.

Help improve this page

To help make sure that this page is useful, relevant and up to date, you can:

Need help?

If you’ve got a question about the GOV.UK Design System, contact the team.