Form checkboxes example

Checkbox with exclusive item

Allows an option to become exclusive, as follows:

  • when the exclusive item is checked, all non-exclusive items are unchecked
  • when a non-exclusive item is checked, the exclusive item is unchecked

This behaviour should be doubled by similar checks on the backend.

How it looks (preview)

What kind of expertise can you offer?
Select the types of support you can offer.
or

How to call this example

<%= render "govuk_publishing_components/components/checkboxes", {
  name: "nationality-exclusive[]",
  heading: "What kind of expertise can you offer?",
  hint_text: "Select the types of support you can offer.",
  items: [
    {
      label: "Medical",
      value: "medical"
    },
    {
      label: "Engineering",
      value: "engineering"
    },
    {
      label: "Other",
      value: "other"
    },
    "or",
    {
      label: "I cannot offer expertise",
      value: "no-expertise",
      exclusive: true
    }
  ]
} %>