1. Component Guide
  2. Form checkboxes
  3. With custom ids on individal checkboxes
Form checkboxes example

With custom ids on individal checkboxes

Individual checkboxes can be given specific ids if required. Note that the general id option can still be used, but the individual ids will override the general one if it is given.

How it looks (preview)

What kind of carrots do you like?
Select all that apply.

How to call this example

<%= render "govuk_publishing_components/components/checkboxes", {
  name: "carrots[]",
  id: "carrots",
  heading: "What kind of carrots do you like?",
  items: [
    {
      label: "Orange",
      value: "orange",
      id: "custom-orange-id"
    },
    {
      label: "Purple",
      value: "purple"
    }
  ]
} %>