1. Component Guide
  2. Form checkboxes
  3. With multiple checkboxes
Form checkboxes example

With multiple checkboxes

When more than one checkbox is shown they are wrapped in a fieldset element, which requires a legend. This must be supplied to the component using the heading option.

How it looks (preview)

What is your favourite colour?
Select all that apply.

How to call this example

<%= render "govuk_publishing_components/components/checkboxes", {
  name: "favourite_colour[]",
  heading: "What is your favourite colour?",
  items: [
    {
      label: "Red",
      value: "red"
    },
    {
      label: "Green",
      value: "green"
    },
    {
      label: "Blue",
      value: "blue"
    }
  ]
} %>