Date input
These examples are used for automated tests and may not follow service manual best practice.
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
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
Date input day and month (empty item)
Open this example in a new tab: Date input day and month (empty item)
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
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
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
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
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
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
Date input month and year (empty item)
Open this example in a new tab: Date input month and year (empty item)
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
Date input month and year with values
Open this example in a new tab: Date input month and year with values
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
Date input with autocomplete values
Open this example in a new tab: Date input with autocomplete values
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
Date input with custom name prefix
Open this example in a new tab: Date input with custom name prefix
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
Date input with error on day input
Open this example in a new tab: Date input with error on day input
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">
<label class="nhsuk-label nhsuk-date-input__label" for="example-day">
Day
</label>
<input class="nhsuk-input nhsuk-input--width-2 nhsuk-input--error 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
Date input with error on month input
Open this example in a new tab: Date input with error on month input
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">
<label class="nhsuk-label nhsuk-date-input__label" for="example-month">
Month
</label>
<input class="nhsuk-input nhsuk-input--width-2 nhsuk-input--error 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
Date input with error on year input
Open this example in a new tab: Date input with error on year input
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">
<label class="nhsuk-label nhsuk-date-input__label" for="example-year">
Year
</label>
<input class="nhsuk-input nhsuk-input--width-4 nhsuk-input--error nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
</div>
</div>
</div>
</fieldset>
</div>
Macro
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">
<label class="nhsuk-label nhsuk-date-input__label" for="example-day">
Day
</label>
<input class="nhsuk-input nhsuk-input--width-2 nhsuk-input--error 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-input--error 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-input--error nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
</div>
</div>
</div>
</fieldset>
</div>
Macro
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">
<label class="nhsuk-label nhsuk-date-input__label" for="example-day">
Day
</label>
<input class="nhsuk-input nhsuk-input--width-2 nhsuk-input--error 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-input--error 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-input--error nhsuk-date-input__input" id="example-year" name="year" type="text" inputmode="numeric">
</div>
</div>
</div>
</fieldset>
</div>
Macro
Code
Markup
<div class="nhsuk-form-group">
<fieldset class="nhsuk-fieldset" role="group" aria-describedby="example-hint">
<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>
<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
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>