This is an internal development app.
To learn how to use the GOV.UK Design System in your project, see Get started.

Skip to main content
  1. GOV.UK Frontend
  2. All components
  3. Checkboxes

Checkboxes

Code

Markup

<div class="govuk-form-group">
  <div class="govuk-checkboxes" data-module="govuk-checkboxes">
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="nationality" name="nationality" type="checkbox" value="british">
      <label class="govuk-label govuk-checkboxes__label" for="nationality">
        British
      </label>
    </div>
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="nationality-2" name="nationality" type="checkbox" value="irish">
      <label class="govuk-label govuk-checkboxes__label" for="nationality-2">
        Irish
      </label>
    </div>
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="nationality-3" name="nationality" type="checkbox" value="other">
      <label class="govuk-label govuk-checkboxes__label" for="nationality-3">
        Citizen of another country
      </label>
    </div>
  </div>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "nationality",
  items: [
    {
      value: "british",
      text: "British"
    },
    {
      value: "irish",
      text: "Irish"
    },
    {
      value: "other",
      text: "Citizen of another country"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <div class="govuk-checkboxes" data-module="govuk-checkboxes">
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="nationality" name="nationality" type="checkbox" value="british" checked>
      <label class="govuk-label govuk-checkboxes__label" for="nationality">
        British
      </label>
    </div>
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="nationality-2" name="nationality" type="checkbox" value="irish">
      <label class="govuk-label govuk-checkboxes__label" for="nationality-2">
        Irish
      </label>
    </div>
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="nationality-3" name="nationality" type="checkbox" value="other" checked data-aria-controls="conditional-nationality-3">
      <label class="govuk-label govuk-checkboxes__label" for="nationality-3">
        Citizen of another country
      </label>
    </div>
    <div class="govuk-checkboxes__conditional" id="conditional-nationality-3">
      <div class="govuk-form-group">
  <label class="govuk-label" for="other-country">
    Country
  </label>
  <input class="govuk-input" id="other-country" name="other-country" type="text" value="Ravka">
</div>
    </div>
  </div>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "nationality",
  items: [
    {
      value: "british",
      text: "British"
    },
    {
      value: "irish",
      text: "Irish"
    },
    {
      value: "other",
      text: "Citizen of another country",
      conditional: {
        html:
          '<div class="govuk-form-group">\n' +
          '  <label class="govuk-label" for="other-country">\n' +
          "    Country\n" +
          "  </label>\n" +
          '  <input class="govuk-input" id="other-country" name="other-country" type="text" value="Ravka">\n' +
          "</div>\n"
      }
    }
  ],
  values: ["british", "other"]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
      <h1 class="govuk-fieldset__heading">
        Which types of waste do you transport regularly?
      </h1>
    </legend>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="with-divider-and-none" name="with-divider-and-none" type="checkbox" value="animal">
        <label class="govuk-label govuk-checkboxes__label" for="with-divider-and-none">
          Waste from animal carcasses
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="with-divider-and-none-2" name="with-divider-and-none" type="checkbox" value="mines">
        <label class="govuk-label govuk-checkboxes__label" for="with-divider-and-none-2">
          Waste from mines or quarries
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="with-divider-and-none-3" name="with-divider-and-none" type="checkbox" value="farm">
        <label class="govuk-label govuk-checkboxes__label" for="with-divider-and-none-3">
          Farm or agricultural waste
        </label>
      </div>
      <div class="govuk-checkboxes__divider">or</div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="with-divider-and-none-5" name="with-divider-and-none" type="checkbox" value="none" data-behaviour="exclusive">
        <label class="govuk-label govuk-checkboxes__label" for="with-divider-and-none-5">
          None of these
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "with-divider-and-none",
  fieldset: {
    legend: {
      text: "Which types of waste do you transport regularly?",
      classes: "govuk-fieldset__legend--l",
      isPageHeading: true
    }
  },
  items: [
    {
      value: "animal",
      text: "Waste from animal carcasses"
    },
    {
      value: "mines",
      text: "Waste from mines or quarries"
    },
    {
      value: "farm",
      text: "Farm or agricultural waste"
    },
    {
      divider: "or"
    },
    {
      value: "none",
      text: "None of these",
      behaviour: "exclusive"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
      <h1 class="govuk-fieldset__heading">
        Do you have any access needs?
      </h1>
    </legend>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="with-divider-and-none-and-conditional-items" name="with-divider-and-none-and-conditional-items" type="checkbox" value="accessible-toilets">
        <label class="govuk-label govuk-checkboxes__label" for="with-divider-and-none-and-conditional-items">
          Accessible toilets available
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="with-divider-and-none-and-conditional-items-2" name="with-divider-and-none-and-conditional-items" type="checkbox" value="braille">
        <label class="govuk-label govuk-checkboxes__label" for="with-divider-and-none-and-conditional-items-2">
          Braille translation service available
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="with-divider-and-none-and-conditional-items-3" name="with-divider-and-none-and-conditional-items" type="checkbox" value="disabled-car-parking">
        <label class="govuk-label govuk-checkboxes__label" for="with-divider-and-none-and-conditional-items-3">
          Disabled car parking available
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="with-divider-and-none-and-conditional-items-4" name="with-divider-and-none-and-conditional-items" type="checkbox" value="another-access-need" data-aria-controls="conditional-with-divider-and-none-and-conditional-items-4">
        <label class="govuk-label govuk-checkboxes__label" for="with-divider-and-none-and-conditional-items-4">
          Another access need
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-with-divider-and-none-and-conditional-items-4">
        <label class="govuk-label" for="other-access-needs">Other access needs</label>
  <textarea class="govuk-textarea govuk-!-width-one-third" name="other-access-needs" id="other-access-needs"></textarea>
      </div>
      <div class="govuk-checkboxes__divider">or</div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="with-divider-and-none-and-conditional-items-6" name="with-divider-and-none-and-conditional-items" type="checkbox" value="none" data-behaviour="exclusive">
        <label class="govuk-label govuk-checkboxes__label" for="with-divider-and-none-and-conditional-items-6">
          None of these
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "with-divider-and-none-and-conditional-items",
  fieldset: {
    legend: {
      text: "Do you have any access needs?",
      classes: "govuk-fieldset__legend--l",
      isPageHeading: true
    }
  },
  items: [
    {
      value: "accessible-toilets",
      text: "Accessible toilets available"
    },
    {
      value: "braille",
      text: "Braille translation service available"
    },
    {
      value: "disabled-car-parking",
      text: "Disabled car parking available"
    },
    {
      value: "another-access-need",
      text: "Another access need",
      conditional: {
        html:
          '<label class="govuk-label" for="other-access-needs">Other access needs</label>\n' +
          '<textarea class="govuk-textarea govuk-!-width-one-third" name="other-access-needs" id="other-access-needs"></textarea>\n'
      }
    },
    {
      divider: "or"
    },
    {
      value: "none",
      text: "None of these",
      behaviour: "exclusive"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset" aria-describedby="with-id-and-name-hint">
    <legend class="govuk-fieldset__legend">
      What is your nationality?
    </legend>
    <div id="with-id-and-name-hint" class="govuk-hint">
      If you have dual nationality, select all options that are relevant to you.
    </div>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="item_british" name="british" type="checkbox" value="yes">
        <label class="govuk-label govuk-checkboxes__label" for="item_british">
          British
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="item_irish" name="irish" type="checkbox" value="irish">
        <label class="govuk-label govuk-checkboxes__label" for="item_irish">
          Irish
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="with-id-and-name-3" name="custom-name-scottish" type="checkbox" value="scottish">
        <label class="govuk-label govuk-checkboxes__label" for="with-id-and-name-3">
          Scottish
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "with-id-and-name",
  fieldset: {
    legend: {
      text: "What is your nationality?"
    }
  },
  hint: {
    text: "If you have dual nationality, select all options that are relevant to you."
  },
  items: [
    {
      name: "british",
      id: "item_british",
      value: "yes",
      text: "British"
    },
    {
      name: "irish",
      id: "item_irish",
      value: "irish",
      text: "Irish"
    },
    {
      name: "custom-name-scottish",
      text: "Scottish",
      value: "scottish"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
      <h1 class="govuk-fieldset__heading">
        How do you want to sign in?
      </h1>
    </legend>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="government-gateway" name="gateway" type="checkbox" value="gov-gateway" aria-describedby="government-gateway-item-hint">
        <label class="govuk-label govuk-checkboxes__label" for="government-gateway">
          Sign in with Government Gateway
        </label>
        <div id="government-gateway-item-hint" class="govuk-hint govuk-checkboxes__hint">
          You&#39;ll have a user ID if you&#39;ve registered for Self Assessment or filed a tax return online before.
        </div>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="govuk-verify" name="verify" type="checkbox" value="gov-verify" aria-describedby="govuk-verify-item-hint">
        <label class="govuk-label govuk-checkboxes__label" for="govuk-verify">
          Sign in with GOV.UK Verify
        </label>
        <div id="govuk-verify-item-hint" class="govuk-hint govuk-checkboxes__hint">
          You&#39;ll have an account if you&#39;ve already proved your identity with either Barclays, CitizenSafe, Digidentity, Experian, Post Office, Royal Mail or SecureIdentity.
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "with-hints-on-items",
  screenshot: true,
  fieldset: {
    legend: {
      text: "How do you want to sign in?",
      classes: "govuk-fieldset__legend--l",
      isPageHeading: true
    }
  },
  items: [
    {
      name: "gateway",
      id: "government-gateway",
      value: "gov-gateway",
      text: "Sign in with Government Gateway",
      hint: {
        text: "You'll have a user ID if you've registered for Self Assessment or filed a tax return online before."
      }
    },
    {
      name: "verify",
      id: "govuk-verify",
      value: "gov-verify",
      text: "Sign in with GOV.UK Verify",
      hint: {
        text: "You'll have an account if you've already proved your identity with either Barclays, CitizenSafe, Digidentity, Experian, Post Office, Royal Mail or SecureIdentity."
      }
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
      <h1 class="govuk-fieldset__heading">
        How do you want to sign in?
      </h1>
    </legend>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="government-gateway" name="gateway" type="checkbox" value="gov-gateway" aria-describedby="government-gateway-item-hint">
        <label class="govuk-label govuk-checkboxes__label" for="government-gateway">
          Sign in with Government Gateway
        </label>
        <div id="government-gateway-item-hint" class="govuk-hint govuk-checkboxes__hint">
          You&#39;ll have a user ID if you&#39;ve registered for Self Assessment or filed a tax return online before.
        </div>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="govuk-verify" name="verify" type="checkbox" value="gov-verify" disabled aria-describedby="govuk-verify-item-hint">
        <label class="govuk-label govuk-checkboxes__label" for="govuk-verify">
          Sign in with GOV.UK Verify
        </label>
        <div id="govuk-verify-item-hint" class="govuk-hint govuk-checkboxes__hint">
          You&#39;ll have an account if you&#39;ve already proved your identity with either Barclays, CitizenSafe, Digidentity, Experian, Post Office, Royal Mail or SecureIdentity.
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "sign-in",
  fieldset: {
    legend: {
      text: "How do you want to sign in?",
      classes: "govuk-fieldset__legend--l",
      isPageHeading: true
    }
  },
  items: [
    {
      name: "gateway",
      id: "government-gateway",
      value: "gov-gateway",
      text: "Sign in with Government Gateway",
      hint: {
        text: "You'll have a user ID if you've registered for Self Assessment or filed a tax return online before."
      }
    },
    {
      name: "verify",
      id: "govuk-verify",
      value: "gov-verify",
      text: "Sign in with GOV.UK Verify",
      hint: {
        text: "You'll have an account if you've already proved your identity with either Barclays, CitizenSafe, Digidentity, Experian, Post Office, Royal Mail or SecureIdentity."
      },
      disabled: true
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset" aria-describedby="waste-hint">
    <legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
      <h1 class="govuk-fieldset__heading">
        Which types of waste do you transport regularly?
      </h1>
    </legend>
    <div id="waste-hint" class="govuk-hint">
      Select all that apply
    </div>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste" name="waste" type="checkbox" value="animal">
        <label class="govuk-label govuk-checkboxes__label" for="waste">
          Waste from animal carcasses
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="mines">
        <label class="govuk-label govuk-checkboxes__label" for="waste-2">
          Waste from mines or quarries
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="farm">
        <label class="govuk-label govuk-checkboxes__label" for="waste-3">
          Farm or agricultural waste
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "waste",
  fieldset: {
    legend: {
      text: "Which types of waste do you transport regularly?",
      classes: "govuk-fieldset__legend--l",
      isPageHeading: true
    }
  },
  hint: {
    text: "Select all that apply"
  },
  items: [
    {
      value: "animal",
      text: "Waste from animal carcasses"
    },
    {
      value: "mines",
      text: "Waste from mines or quarries"
    },
    {
      value: "farm",
      text: "Farm or agricultural waste"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group govuk-form-group--error">
  <fieldset class="govuk-fieldset" aria-describedby="waste-hint waste-error">
    <legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
      Which types of waste do you transport regularly?
    </legend>
    <div id="waste-hint" class="govuk-hint">
      Select all that apply
    </div>
    <p id="waste-error" class="govuk-error-message">
      <span class="govuk-visually-hidden">Error:</span> Select which types of waste you transport regularly
    </p>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste" name="waste" type="checkbox" value="animal">
        <label class="govuk-label govuk-checkboxes__label" for="waste">
          Waste from animal carcasses
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="mines">
        <label class="govuk-label govuk-checkboxes__label" for="waste-2">
          Waste from mines or quarries
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="farm">
        <label class="govuk-label govuk-checkboxes__label" for="waste-3">
          Farm or agricultural waste
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "waste",
  fieldset: {
    legend: {
      text: "Which types of waste do you transport regularly?",
      classes: "govuk-fieldset__legend--m"
    }
  },
  hint: {
    text: "Select all that apply"
  },
  errorMessage: {
    text: "Select which types of waste you transport regularly"
  },
  items: [
    {
      value: "animal",
      text: "Waste from animal carcasses"
    },
    {
      value: "mines",
      text: "Waste from mines or quarries"
    },
    {
      value: "farm",
      text: "Farm or agricultural waste"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <div class="govuk-checkboxes" data-module="govuk-checkboxes">
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="colours" name="colours" type="checkbox" value="red">
      <label class="govuk-label govuk-checkboxes__label" for="colours">
        Red
      </label>
    </div>
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="colours-2" name="colours" type="checkbox" value="green">
      <label class="govuk-label govuk-checkboxes__label" for="colours-2">
        Green
      </label>
    </div>
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="colours-3" name="colours" type="checkbox" value="blue">
      <label class="govuk-label govuk-checkboxes__label" for="colours-3">
        Blue
      </label>
    </div>
  </div>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "colours",
  items: [
    {
      value: "red",
      text: "Red"
    },
    {
      value: "green",
      text: "Green"
    },
    {
      value: "blue",
      text: "Blue"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group govuk-form-group--error">
  <p id="t-and-c-error" class="govuk-error-message">
    <span class="govuk-visually-hidden">Error:</span> Please accept the terms and conditions
  </p>
  <div class="govuk-checkboxes" data-module="govuk-checkboxes">
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="t-and-c" name="t-and-c" type="checkbox" value="yes" aria-describedby="t-and-c-error">
      <label class="govuk-label govuk-checkboxes__label" for="t-and-c">
        I agree to the terms and conditions
      </label>
    </div>
  </div>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "t-and-c",
  errorMessage: {
    text: "Please accept the terms and conditions"
  },
  items: [
    {
      value: "yes",
      text: "I agree to the terms and conditions"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group govuk-form-group--error">
  <p id="t-and-c-with-hint-error" class="govuk-error-message">
    <span class="govuk-visually-hidden">Error:</span> Please accept the terms and conditions
  </p>
  <div class="govuk-checkboxes" data-module="govuk-checkboxes">
    <div class="govuk-checkboxes__item">
      <input class="govuk-checkboxes__input" id="t-and-c-with-hint" name="t-and-c-with-hint" type="checkbox" value="yes" aria-describedby="t-and-c-with-hint-error t-and-c-with-hint-item-hint">
      <label class="govuk-label govuk-checkboxes__label" for="t-and-c-with-hint">
        I agree to the terms and conditions
      </label>
      <div id="t-and-c-with-hint-item-hint" class="govuk-hint govuk-checkboxes__hint">
        Go on, you know you want to!
      </div>
    </div>
  </div>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "t-and-c-with-hint",
  errorMessage: {
    text: "Please accept the terms and conditions"
  },
  items: [
    {
      value: "yes",
      text: "I agree to the terms and conditions",
      hint: {
        text: "Go on, you know you want to!"
      }
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group govuk-form-group--error">
  <fieldset class="govuk-fieldset" aria-describedby="nationality-error">
    <legend class="govuk-fieldset__legend">
      What is your nationality?
    </legend>
    <p id="nationality-error" class="govuk-error-message">
      <span class="govuk-visually-hidden">Error:</span> Please accept the terms and conditions
    </p>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality" name="nationality" type="checkbox" value="british">
        <label class="govuk-label govuk-checkboxes__label" for="nationality">
          British
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-2" name="nationality" type="checkbox" value="irish">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-2">
          Irish
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-3" name="nationality" type="checkbox" value="other">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-3">
          Citizen of another country
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "nationality",
  errorMessage: {
    text: "Please accept the terms and conditions"
  },
  fieldset: {
    legend: {
      text: "What is your nationality?"
    }
  },
  items: [
    {
      value: "british",
      text: "British"
    },
    {
      value: "irish",
      text: "Irish"
    },
    {
      value: "other",
      text: "Citizen of another country"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group govuk-form-group--error">
  <fieldset class="govuk-fieldset" aria-describedby="waste-error">
    <legend class="govuk-fieldset__legend">
      Which types of waste do you transport regularly?
    </legend>
    <p id="waste-error" class="govuk-error-message">
      <span class="govuk-visually-hidden">Error:</span> Please select an option
    </p>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste" name="waste" type="checkbox" value="animal">
        <label class="govuk-label govuk-checkboxes__label" for="waste">
          Waste from animal carcasses
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="mines">
        <label class="govuk-label govuk-checkboxes__label" for="waste-2">
          Waste from mines or quarries
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="farm">
        <label class="govuk-label govuk-checkboxes__label" for="waste-3">
          Farm or agricultural waste
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "waste",
  errorMessage: {
    text: "Please select an option"
  },
  fieldset: {
    legend: {
      text: "Which types of waste do you transport regularly?"
    }
  },
  items: [
    {
      value: "animal",
      text: "Waste from animal carcasses"
    },
    {
      value: "mines",
      text: "Waste from mines or quarries"
    },
    {
      value: "farm",
      text: "Farm or agricultural waste"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group govuk-form-group--error">
  <fieldset class="govuk-fieldset" aria-describedby="waste-error">
    <legend class="govuk-fieldset__legend">
      Which types of waste do you transport regularly?
    </legend>
    <p id="waste-error" class="govuk-error-message">
      <span class="govuk-visually-hidden">Error:</span> Please select an option
    </p>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste" name="waste" type="checkbox" value="animal" aria-describedby="waste-item-hint">
        <label class="govuk-label govuk-checkboxes__label" for="waste">
          Waste from animal carcasses
        </label>
        <div id="waste-item-hint" class="govuk-hint govuk-checkboxes__hint">
          Nullam id dolor id nibh ultricies vehicula ut id elit.
        </div>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="mines" aria-describedby="waste-2-item-hint">
        <label class="govuk-label govuk-checkboxes__label" for="waste-2">
          Waste from mines or quarries
        </label>
        <div id="waste-2-item-hint" class="govuk-hint govuk-checkboxes__hint">
          Nullam id dolor id nibh ultricies vehicula ut id elit.
        </div>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="farm" aria-describedby="waste-3-item-hint">
        <label class="govuk-label govuk-checkboxes__label" for="waste-3">
          Farm or agricultural waste
        </label>
        <div id="waste-3-item-hint" class="govuk-hint govuk-checkboxes__hint">
          Nullam id dolor id nibh ultricies vehicula ut id elit.
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "waste",
  errorMessage: {
    text: "Please select an option"
  },
  fieldset: {
    legend: {
      text: "Which types of waste do you transport regularly?"
    }
  },
  items: [
    {
      value: "animal",
      text: "Waste from animal carcasses",
      hint: {
        text: "Nullam id dolor id nibh ultricies vehicula ut id elit."
      }
    },
    {
      value: "mines",
      text: "Waste from mines or quarries",
      hint: {
        text: "Nullam id dolor id nibh ultricies vehicula ut id elit."
      }
    },
    {
      value: "farm",
      text: "Farm or agricultural waste",
      hint: {
        text: "Nullam id dolor id nibh ultricies vehicula ut id elit."
      }
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group govuk-form-group--error">
  <fieldset class="govuk-fieldset" aria-describedby="waste-hint waste-error">
    <legend class="govuk-fieldset__legend">
      Maecenas faucibus mollis interdum?
    </legend>
    <div id="waste-hint" class="govuk-hint">
      Nullam id dolor id nibh ultricies vehicula ut id elit.
    </div>
    <p id="waste-error" class="govuk-error-message">
      <span class="govuk-visually-hidden">Error:</span> Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    </p>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste" name="waste" type="checkbox" value="nullam">
        <label class="govuk-label govuk-checkboxes__label" for="waste">
          Nullam id dolor id nibh ultricies vehicula ut id elit. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Maecenas faucibus mollis interdum. Donec id elit non mi porta gravida at eget metus.
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="aenean">
        <label class="govuk-label govuk-checkboxes__label" for="waste-2">
          Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Cras mattis consectetur purus sit amet fermentum.
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="fusce">
        <label class="govuk-label govuk-checkboxes__label" for="waste-3">
          Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Sed posuere consectetur est at lobortis.
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "waste",
  hint: {
    text: "Nullam id dolor id nibh ultricies vehicula ut id elit."
  },
  errorMessage: {
    text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
  },
  fieldset: {
    legend: {
      text: "Maecenas faucibus mollis interdum?"
    }
  },
  items: [
    {
      value: "nullam",
      text: "Nullam id dolor id nibh ultricies vehicula ut id elit. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Maecenas faucibus mollis interdum. Donec id elit non mi porta gravida at eget metus."
    },
    {
      value: "aenean",
      text: "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Cras mattis consectetur purus sit amet fermentum."
    },
    {
      value: "fusce",
      text: "Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Sed posuere consectetur est at lobortis."
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend">
      How do you want to be contacted?
    </legend>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted" name="with-conditional-items" type="checkbox" value="email" data-aria-controls="conditional-how-contacted">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted">
          Email
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-how-contacted">
        <label class="govuk-label" for="context-email">Email address</label>
  <input class="govuk-input govuk-!-width-one-third" name="context-email" type="text" id="context-email">
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted-2" name="with-conditional-items" type="checkbox" value="phone" data-aria-controls="conditional-how-contacted-2">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted-2">
          Phone
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-how-contacted-2">
        <label class="govuk-label" for="contact-phone">Phone number</label>
  <input class="govuk-input govuk-!-width-one-third" name="contact-phone" type="text" id="contact-phone">
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted-3" name="with-conditional-items" type="checkbox" value="text" data-aria-controls="conditional-how-contacted-3">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted-3">
          Text message
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-how-contacted-3">
        <label class="govuk-label" for="contact-text-message">Mobile phone number</label>
  <input class="govuk-input govuk-!-width-one-third" name="contact-text-message" type="text" id="contact-text-message">
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "with-conditional-items",
  idPrefix: "how-contacted",
  fieldset: {
    legend: {
      text: "How do you want to be contacted?"
    }
  },
  items: [
    {
      value: "email",
      text: "Email",
      conditional: {
        html:
          '<label class="govuk-label" for="context-email">Email address</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="context-email" type="text" id="context-email">\n'
      }
    },
    {
      value: "phone",
      text: "Phone",
      conditional: {
        html:
          '<label class="govuk-label" for="contact-phone">Phone number</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="contact-phone" type="text" id="contact-phone">\n'
      }
    },
    {
      value: "text",
      text: "Text message",
      conditional: {
        html:
          '<label class="govuk-label" for="contact-text-message">Mobile phone number</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="contact-text-message" type="text" id="contact-text-message">\n'
      }
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend">
      How do you want to be contacted?
    </legend>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="user.profile[contact-prefs]" name="contact-prefs" type="checkbox" value="email" data-aria-controls="conditional-user.profile[contact-prefs]">
        <label class="govuk-label govuk-checkboxes__label" for="user.profile[contact-prefs]">
          Email
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-user.profile[contact-prefs]">
        <label class="govuk-label" for="context-email">Email address</label>
  <input class="govuk-input govuk-!-width-one-third" name="context-email" type="text" id="context-email">
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="user.profile[contact-prefs]-2" name="contact-prefs" type="checkbox" value="phone" data-aria-controls="conditional-user.profile[contact-prefs]-2">
        <label class="govuk-label govuk-checkboxes__label" for="user.profile[contact-prefs]-2">
          Phone
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-user.profile[contact-prefs]-2">
        <label class="govuk-label" for="contact-phone">Phone number</label>
  <input class="govuk-input govuk-!-width-one-third" name="contact-phone" type="text" id="contact-phone">
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="user.profile[contact-prefs]-3" name="contact-prefs" type="checkbox" value="text" data-aria-controls="conditional-user.profile[contact-prefs]-3">
        <label class="govuk-label govuk-checkboxes__label" for="user.profile[contact-prefs]-3">
          Text message
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-user.profile[contact-prefs]-3">
        <label class="govuk-label" for="contact-text-message">Mobile phone number</label>
  <input class="govuk-input govuk-!-width-one-third" name="contact-text-message" type="text" id="contact-text-message">
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "contact-prefs",
  idPrefix: "user.profile[contact-prefs]",
  fieldset: {
    legend: {
      text: "How do you want to be contacted?"
    }
  },
  items: [
    {
      value: "email",
      text: "Email",
      conditional: {
        html:
          '<label class="govuk-label" for="context-email">Email address</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="context-email" type="text" id="context-email">\n'
      }
    },
    {
      value: "phone",
      text: "Phone",
      conditional: {
        html:
          '<label class="govuk-label" for="contact-phone">Phone number</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="contact-phone" type="text" id="contact-phone">\n'
      }
    },
    {
      value: "text",
      text: "Text message",
      conditional: {
        html:
          '<label class="govuk-label" for="contact-text-message">Mobile phone number</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="contact-text-message" type="text" id="contact-text-message">\n'
      }
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend">
      How do you want to be contacted?
    </legend>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted-checked" name="how-contacted-checked" type="checkbox" value="email" checked data-aria-controls="conditional-how-contacted-checked">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted-checked">
          Email
        </label>
      </div>
      <div class="govuk-checkboxes__conditional" id="conditional-how-contacted-checked">
        <label class="govuk-label" for="context-email">Email address</label>
  <input class="govuk-input govuk-!-width-one-third" name="context-email" type="text" id="context-email">
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted-checked-2" name="how-contacted-checked" type="checkbox" value="phone" data-aria-controls="conditional-how-contacted-checked-2">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted-checked-2">
          Phone
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-how-contacted-checked-2">
        <label class="govuk-label" for="contact-phone">Phone number</label>
  <input class="govuk-input govuk-!-width-one-third" name="contact-phone" type="text" id="contact-phone">
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted-checked-3" name="how-contacted-checked" type="checkbox" value="text" data-aria-controls="conditional-how-contacted-checked-3">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted-checked-3">
          Text message
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-how-contacted-checked-3">
        <label class="govuk-label" for="contact-text-message">Mobile phone number</label>
  <input class="govuk-input govuk-!-width-one-third" name="contact-text-message" type="text" id="contact-text-message">
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "how-contacted-checked",
  idPrefix: "how-contacted-checked",
  fieldset: {
    legend: {
      text: "How do you want to be contacted?"
    }
  },
  items: [
    {
      value: "email",
      text: "Email",
      checked: true,
      conditional: {
        html:
          '<label class="govuk-label" for="context-email">Email address</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="context-email" type="text" id="context-email">\n'
      }
    },
    {
      value: "phone",
      text: "Phone",
      conditional: {
        html:
          '<label class="govuk-label" for="contact-phone">Phone number</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="contact-phone" type="text" id="contact-phone">\n'
      }
    },
    {
      value: "text",
      text: "Text message",
      conditional: {
        html:
          '<label class="govuk-label" for="contact-text-message">Mobile phone number</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="contact-text-message" type="text" id="contact-text-message">\n'
      }
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group govuk-form-group--error">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend">
      How do you want to be contacted?
    </legend>
    <div class="govuk-checkboxes" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted-checked" name="how-contacted-checked" type="checkbox" value="email" data-aria-controls="conditional-how-contacted-checked">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted-checked">
          Email
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-how-contacted-checked">
        <label class="govuk-label" for="context-email">Email address</label>
  <input class="govuk-input govuk-!-width-one-third" name="context-email" type="text" id="context-email">
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted-checked-2" name="how-contacted-checked" type="checkbox" value="phone" checked data-aria-controls="conditional-how-contacted-checked-2">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted-checked-2">
          Phone
        </label>
      </div>
      <div class="govuk-checkboxes__conditional" id="conditional-how-contacted-checked-2">
        <label class="govuk-label" for="contact-phone">Phone number</label>
  <span id="contact-phone-error" class="govuk-error-message">Problem with input</span>
  <input class="govuk-input govuk-input--error govuk-!-width-one-third" name="contact-phone" type="text" id="contact-phone" aria-describedby="contact-phone-error">
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted-checked-3" name="how-contacted-checked" type="checkbox" value="text" data-aria-controls="conditional-how-contacted-checked-3">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted-checked-3">
          Text message
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-how-contacted-checked-3">
        <label class="govuk-label" for="contact-text-message">Mobile phone number</label>
  <input class="govuk-input govuk-!-width-one-third" name="contact-text-message" type="text" id="contact-text-message">
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "how-contacted-checked",
  idPrefix: "how-contacted-checked",
  formGroup: {
    classes: "govuk-form-group--error"
  },
  fieldset: {
    legend: {
      text: "How do you want to be contacted?"
    }
  },
  items: [
    {
      value: "email",
      text: "Email",
      conditional: {
        html:
          '<label class="govuk-label" for="context-email">Email address</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="context-email" type="text" id="context-email">\n'
      }
    },
    {
      value: "phone",
      text: "Phone",
      checked: true,
      conditional: {
        html:
          '<label class="govuk-label" for="contact-phone">Phone number</label>\n' +
          '<span id="contact-phone-error" class="govuk-error-message">Problem with input</span>\n' +
          '<input class="govuk-input govuk-input--error govuk-!-width-one-third" name="contact-phone" type="text" id="contact-phone" aria-describedby="contact-phone-error">\n'
      }
    },
    {
      value: "text",
      text: "Text message",
      conditional: {
        html:
          '<label class="govuk-label" for="contact-text-message">Mobile phone number</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="contact-text-message" type="text" id="contact-text-message">\n'
      }
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend">
      Filter by
    </legend>
    <div class="govuk-checkboxes govuk-checkboxes--small" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality" name="nationality" type="checkbox" value="a">
        <label class="govuk-label govuk-checkboxes__label" for="nationality">
          a thing
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-2" name="nationality" type="checkbox" value="b">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-2">
          another thing
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-3" name="nationality" type="checkbox" value="c">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-3">
          this thing
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  idPrefix: "nationality",
  name: "nationality",
  classes: "govuk-checkboxes--small",
  fieldset: {
    legend: {
      text: "Filter by"
    }
  },
  items: [
    {
      value: "a",
      text: "a thing"
    },
    {
      value: "b",
      text: "another thing"
    },
    {
      value: "c",
      text: "this thing"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend">
      Filter by
    </legend>
    <div class="govuk-checkboxes govuk-checkboxes--small" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality" name="nationality" type="checkbox" value="nullam">
        <label class="govuk-label govuk-checkboxes__label" for="nationality">
          Nullam id dolor id nibh ultricies vehicula ut id elit. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Maecenas faucibus mollis interdum. Donec id elit non mi porta gravida at eget metus.
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-2" name="nationality" type="checkbox" value="aenean">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-2">
          Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Cras mattis consectetur purus sit amet fermentum.
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-3" name="nationality" type="checkbox" value="fusce">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-3">
          Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Sed posuere consectetur est at lobortis.
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  idPrefix: "nationality",
  name: "nationality",
  classes: "govuk-checkboxes--small",
  fieldset: {
    legend: {
      text: "Filter by"
    }
  },
  items: [
    {
      value: "nullam",
      text: "Nullam id dolor id nibh ultricies vehicula ut id elit. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Maecenas faucibus mollis interdum. Donec id elit non mi porta gravida at eget metus."
    },
    {
      value: "aenean",
      text: "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Cras mattis consectetur purus sit amet fermentum."
    },
    {
      value: "fusce",
      text: "Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Sed posuere consectetur est at lobortis."
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group govuk-form-group--error">
  <fieldset class="govuk-fieldset" aria-describedby="nationality-error">
    <legend class="govuk-fieldset__legend">
      Filter by
    </legend>
    <p id="nationality-error" class="govuk-error-message">
      <span class="govuk-visually-hidden">Error:</span> Select a thing
    </p>
    <div class="govuk-checkboxes govuk-checkboxes--small" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality" name="nationality" type="checkbox" value="a">
        <label class="govuk-label govuk-checkboxes__label" for="nationality">
          a thing
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-2" name="nationality" type="checkbox" value="b">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-2">
          another thing
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-3" name="nationality" type="checkbox" value="c">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-3">
          this thing
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  idPrefix: "nationality",
  name: "nationality",
  classes: "govuk-checkboxes--small",
  errorMessage: {
    text: "Select a thing"
  },
  fieldset: {
    legend: {
      text: "Filter by"
    }
  },
  items: [
    {
      value: "a",
      text: "a thing"
    },
    {
      value: "b",
      text: "another thing"
    },
    {
      value: "c",
      text: "this thing"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend">
      Filter by
    </legend>
    <div class="govuk-checkboxes govuk-checkboxes--small" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality" name="nationality" type="checkbox" value="a" aria-describedby="nationality-item-hint">
        <label class="govuk-label govuk-checkboxes__label" for="nationality">
          a thing
        </label>
        <div id="nationality-item-hint" class="govuk-hint govuk-checkboxes__hint">
          hint for a thing
        </div>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-2" name="nationality" type="checkbox" value="b">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-2">
          another thing
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-3" name="nationality" type="checkbox" value="c">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-3">
          this thing
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  idPrefix: "nationality",
  name: "nationality",
  classes: "govuk-checkboxes--small",
  fieldset: {
    legend: {
      text: "Filter by"
    }
  },
  items: [
    {
      value: "a",
      text: "a thing",
      hint: {
        text: "hint for a thing"
      }
    },
    {
      value: "b",
      text: "another thing"
    },
    {
      value: "c",
      text: "this thing"
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend">
      Filter by
    </legend>
    <div class="govuk-checkboxes govuk-checkboxes--small" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality" name="nationality" type="checkbox" value="a">
        <label class="govuk-label govuk-checkboxes__label" for="nationality">
          a thing
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-2" name="nationality" type="checkbox" value="b">
        <label class="govuk-label govuk-checkboxes__label" for="nationality-2">
          another thing
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="nationality-3" name="nationality" type="checkbox" value="c" disabled>
        <label class="govuk-label govuk-checkboxes__label" for="nationality-3">
          this thing
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  idPrefix: "nationality",
  name: "nationality",
  classes: "govuk-checkboxes--small",
  fieldset: {
    legend: {
      text: "Filter by"
    }
  },
  items: [
    {
      value: "a",
      text: "a thing"
    },
    {
      value: "b",
      text: "another thing"
    },
    {
      value: "c",
      text: "this thing",
      disabled: true
    }
  ]
}) }}
Code

Markup

<div class="govuk-form-group">
  <fieldset class="govuk-fieldset">
    <legend class="govuk-fieldset__legend">
      How do you want to be contacted?
    </legend>
    <div class="govuk-checkboxes govuk-checkboxes--small" data-module="govuk-checkboxes">
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted" name="how-contacted" type="checkbox" value="a" data-aria-controls="conditional-how-contacted">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted">
          a thing
        </label>
      </div>
      <div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-how-contacted">
        <label class="govuk-label" for="context-email">Foo</label>
  <input class="govuk-input govuk-!-width-one-third" name="context-email" type="text" id="context-email">
      </div>
      <div class="govuk-checkboxes__item">
        <input class="govuk-checkboxes__input" id="how-contacted-2" name="how-contacted" type="checkbox" value="b">
        <label class="govuk-label govuk-checkboxes__label" for="how-contacted-2">
          another thing
        </label>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
  name: "how-contacted",
  idPrefix: "how-contacted",
  classes: "govuk-checkboxes--small",
  fieldset: {
    legend: {
      text: "How do you want to be contacted?"
    }
  },
  items: [
    {
      value: "a",
      text: "a thing",
      conditional: {
        html:
          '<label class="govuk-label" for="context-email">Foo</label>\n' +
          '<input class="govuk-input govuk-!-width-one-third" name="context-email" type="text" id="context-email">\n'
      }
    },
    {
      value: "b",
      text: "another thing"
    }
  ]
}) }}