Skip to main content
Preview This is a design system preview environment for main branch

Internal review app NHS.UK frontend

Use design system guidance and examples to build consistent, accessible NHS services for the public and staff.

Date input

These examples are used for automated tests and may not follow service manual best practice.

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example"
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" disabled inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" disabled inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" disabled inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example",
  disabled: true
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" disabled inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example",
  year: {
    disabled: true
  }
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" disabled inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example",
  items: [
    {
      name: "day",
      width: 2
    },
    {
      name: "month",
      width: 2
    },
    {
      name: "year",
      width: 4,
      disabled: true
    }
  ]
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" disabled inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" disabled inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example",
  disabled: true,
  year: {
    disabled: false
  }
}) }}

What is your birthday?

For example, 5 12
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your birthday?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 5 12
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your birthday?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 5 12"
  },
  id: "example",
  year: false
}) }}

What is your birthday?

For example, 5 12
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your birthday?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 5 12
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your birthday?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 5 12"
  },
  id: "example",
  items: [
    {
      name: "day",
      width: 2
    },
    {
      name: "month",
      width: 2
    }
  ]
}) }}

What is your birthday?

For example, 5 12
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your birthday?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 5 12
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your birthday?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 5 12"
  },
  id: "example",
  items: [
    {
      name: "day",
      width: 2
    },
    {
      name: "month",
      width: 2
    },
    false
  ]
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="custom-size-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--s">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="custom-size-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="custom-size">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="custom-size-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="custom-size-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="custom-size-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "s"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "custom-size"
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="custom-size-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--m">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="custom-size-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="custom-size">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="custom-size-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="custom-size-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="custom-size-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "m"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "custom-size"
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="custom-size-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="custom-size-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="custom-size">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="custom-size-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="custom-size-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="custom-size-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "custom-size"
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="custom-size-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--xl">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="custom-size-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="custom-size">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="custom-size-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="custom-size-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="custom-size-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="custom-size-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "xl"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "custom-size"
}) }}

When did you start your job?

For example, 11 2023
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        When did you start your job?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 11 2023
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "When did you start your job?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 11 2023"
  },
  id: "example",
  day: false
}) }}

When did you start your job?

For example, 11 2023
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        When did you start your job?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 11 2023
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "When did you start your job?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 11 2023"
  },
  id: "example",
  items: [
    {
      name: "month",
      width: 2
    },
    {
      name: "year",
      width: 4
    }
  ]
}) }}

When did you start your job?

For example, 11 2023
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        When did you start your job?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 11 2023
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "When did you start your job?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 11 2023"
  },
  id: "example",
  items: [
    false,
    {
      name: "month",
      width: 2
    },
    {
      name: "year",
      width: 4
    }
  ]
}) }}

When did you start your job?

For example, 11 2023
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        When did you start your job?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 11 2023
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="11" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="2023" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "When did you start your job?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 11 2023"
  },
  id: "example",
  day: false,
  month: {
    value: "11"
  },
  year: {
    value: "2023"
  }
}) }}

Date input month and year with fields overriding values

Open this example in a new tab: Date input month and year with fields overriding values

When did you start your job?

For example, 11 2023
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        When did you start your job?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 11 2023
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="11" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="2023" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "When did you start your job?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 11 2023"
  },
  id: "example",
  day: false,
  month: {
    value: "11"
  },
  year: {
    value: "2023"
  },
  values: {
    month: "8",
    year: "2024"
  }
}) }}

When did you start your job?

For example, 11 2023
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        When did you start your job?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 11 2023
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="8" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="2024" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "When did you start your job?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 11 2023"
  },
  id: "example",
  day: false,
  values: {
    month: "8",
    year: "2024"
  }
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" autocomplete="bday-day" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" autocomplete="bday-month" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" autocomplete="bday-year" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example",
  day: {
    autocomplete: "bday-day"
  },
  month: {
    autocomplete: "bday-month"
  },
  year: {
    autocomplete: "bday-year"
  }
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" autocomplete="bday-day" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" autocomplete="bday-month" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" autocomplete="bday-year" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example",
  items: [
    {
      name: "day",
      width: 2,
      autocomplete: "bday-day"
    },
    {
      name: "month",
      width: 2,
      autocomplete: "bday-month"
    },
    {
      name: "year",
      width: 4,
      autocomplete: "bday-year"
    }
  ]
}) }}

What is your date of birth?

For example, 31 3 1980
Before
After
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <samp class="app-annotate">Before</samp>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
      <samp class="app-annotate">After</samp>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example",
  formGroup: {
    beforeInputs: {
      html: '<samp class="app-annotate">Before</samp>'
    },
    afterInputs: {
      html: '<samp class="app-annotate">After</samp>'
    }
  }
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="example[day]" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="example[month]" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="example[year]" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example",
  namePrefix: "example"
}) }}

What is your date of birth?

Error: Enter your date of birth

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-error">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Enter your date of birth
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  errorMessage: {
    text: "Enter your date of birth"
  },
  id: "example"
}) }}

What is your date of birth?

For example, 31 3 1980

Error: Enter your date of birth

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint example-error">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Enter your date of birth
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  errorMessage: {
    text: "Enter your date of birth"
  },
  id: "example"
}) }}

What is your date of birth?

For example, 31 3 1980

Error: Enter your date of birth

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint example-error">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Enter your date of birth
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: "For example, 31 3 1980",
  errorMessage: "Enter your date of birth",
  id: "example"
}) }}

Date input with error message and hint, without heading

Open this example in a new tab: Date input with error message and hint, without heading

What is your date of birth?
For example, 31 3 1980

Error: Enter your date of birth

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint example-error">
    <legend class="nhsuk-fieldset__legend">
      What is your date of birth?
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Enter your date of birth
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: "What is your date of birth?"
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  errorMessage: {
    text: "Enter your date of birth"
  },
  id: "example"
}) }}
What is your date of birth?

Error: Enter your date of birth

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-error">
    <legend class="nhsuk-fieldset__legend">
      What is your date of birth?
    </legend>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Enter your date of birth
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: "What is your date of birth?"
  },
  errorMessage: {
    text: "Enter your date of birth"
  },
  id: "example"
}) }}

What is your date of birth?

For example, 31 3 1980

Error: Date of birth must include a day

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint example-error">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Date of birth must include a day
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="3" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="1980" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  errorMessage: {
    text: "Date of birth must include a day"
  },
  id: "example",
  day: {
    error: true
  },
  month: {
    value: "3"
  },
  year: {
    value: "1980"
  }
}) }}

What is your date of birth?

For example, 31 3 1980

Error: Date of birth must include a day

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint example-error">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Date of birth must include a day
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="3" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="1980" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  errorMessage: {
    text: "Date of birth must include a day"
  },
  id: "example",
  items: [
    {
      name: "day",
      width: 2,
      error: true
    },
    {
      name: "month",
      value: "3",
      width: 2
    },
    {
      name: "year",
      value: "1980",
      width: 4
    }
  ]
}) }}

What is your date of birth?

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  errorMessage: true,
  id: "example"
}) }}

What is your date of birth?

For example, 31 3 1980

Error: Date of birth must include a month

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint example-error">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Date of birth must include a month
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" value="31" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="1980" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  errorMessage: {
    text: "Date of birth must include a month"
  },
  id: "example",
  items: [
    {
      name: "day",
      width: 2,
      value: "31"
    },
    {
      name: "month",
      width: 2,
      error: true
    },
    {
      name: "year",
      width: 4,
      value: "1980"
    }
  ]
}) }}

What is your date of birth?

For example, 31 3 1980

Error: Date of birth must include a month

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint example-error">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Date of birth must include a month
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" value="31" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="1980" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  errorMessage: {
    text: "Date of birth must include a month"
  },
  id: "example",
  day: {
    value: "31"
  },
  month: {
    error: true
  },
  year: {
    value: "1980"
  }
}) }}

What is your date of birth?

For example, 31 3 1980

Error: Date of birth must include a year

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint example-error">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Date of birth must include a year
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" value="31" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="3" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  errorMessage: {
    text: "Date of birth must include a year"
  },
  id: "example",
  day: {
    value: "31"
  },
  month: {
    value: "3"
  },
  year: {
    error: true
  }
}) }}

What is your date of birth?

For example, 31 3 1980

Error: Date of birth must include a year

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint example-error">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <p class="nhsuk-error-message" id="example-error">
      <span class="nhsuk-u-visually-hidden">Error: </span>Date of birth must include a year
    </p>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" value="31" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="3" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  errorMessage: {
    text: "Date of birth must include a year"
  },
  id: "example",
  items: [
    {
      name: "day",
      width: 2,
      value: "31"
    },
    {
      name: "month",
      width: 2,
      value: "3"
    },
    {
      name: "year",
      width: 4,
      error: true
    }
  ]
}) }}

What is your date of birth?

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  id: "example",
  day: {
    error: true
  },
  month: {
    error: true
  },
  year: {
    error: true
  }
}) }}

What is your date of birth?

Code

Markup

<div class="nhsuk-form-group nhsuk-form-group--error">
  <fieldset class="nhsuk-fieldset" role="group">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group nhsuk-form-group--error">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--error nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  id: "example",
  items: [
    {
      name: "day",
      width: 2,
      error: true
    },
    {
      name: "month",
      width: 2,
      error: true
    },
    {
      name: "year",
      width: 4,
      error: true
    }
  ]
}) }}

What is your date of birth?

For example, 11 2023
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 11 2023
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" value="5" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="8" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="2024" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 11 2023"
  },
  id: "example",
  day: {
    value: "5"
  },
  month: {
    value: "8"
  },
  year: {
    value: "2024"
  }
}) }}

What is your date of birth?

For example, 11 2023
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 11 2023
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" value="5" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="8" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="2024" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 11 2023"
  },
  id: "example",
  day: 5,
  month: 8,
  year: 2024
}) }}

What is your date of birth?

For example, 11 2023
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 11 2023
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" value="5" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="8" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="2024" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 11 2023"
  },
  id: "example",
  day: "5",
  month: "8",
  year: "2024"
}) }}
What is your date of birth?
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group">
    <legend class="nhsuk-fieldset__legend">
      What is your date of birth?
    </legend>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: "What is your date of birth?"
  },
  id: "example"
}) }}

Beth yw eich dyddiad geni?

Er enghraifft, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        Beth yw eich dyddiad geni?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      Er enghraifft, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Dydd
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Mis
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Blwyddyn
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "Beth yw eich dyddiad geni?",
      size: "l"
    }
  },
  hint: {
    text: "Er enghraifft, 31 3 1980"
  },
  id: "example",
  day: {
    label: "Dydd"
  },
  month: {
    label: "Mis"
  },
  year: {
    label: "Blwyddyn"
  }
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" value="5" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="8" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="2024" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example",
  values: {
    day: "5",
    month: "8",
    year: "2024"
  }
}) }}

What is your date of birth?

For example, 31 3 1980
Code

Markup

<div class="nhsuk-form-group">
  <fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
    <legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
      <h1 class="nhsuk-fieldset__heading">
        What is your date of birth?
      </h1>
    </legend>
    <div class="nhsuk-hint" id="example-hint">
      For example, 31 3 1980
    </div>
    <div class="nhsuk-date-input" id="example">
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-day">
            Day
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-day" name="day" type="text" value="5" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-month">
            Month
          </label>
          <input class="nhsuk-input nhsuk-input--width-2 nhsuk-date-input__input" id="example-month" name="month" type="text" value="8" inputmode="numeric">
        </div>
      </div>
      <div class="nhsuk-date-input__item">
        <div class="nhsuk-form-group">
          <label class="nhsuk-label nhsuk-date-input__label" for="example-year">
            Year
          </label>
          <input class="nhsuk-input nhsuk-input--width-4 nhsuk-date-input__input" id="example-year" name="year" type="text" value="2024" inputmode="numeric">
        </div>
      </div>
    </div>
  </fieldset>
</div>

Macro

{% from "date-input/macro.njk" import dateInput -%}

{{ dateInput({
  fieldset: {
    legend: {
      heading: "What is your date of birth?",
      size: "l"
    }
  },
  hint: {
    text: "For example, 31 3 1980"
  },
  id: "example",
  values: {
    day: 5,
    month: 8,
    year: 2024
  }
}) }}