Default
Empty boxes, with an example date in the hint.
Two ways to give a date: type it into Day, Month and Year boxes, or type it into one box with an optional calendar to pick from. Both always accept typing, so a calendar is never the only way in.
Updated
Date input
Paste this markup in your form
<fieldset class="nds-date-input nds-date-input--typed" id="date-of-birth" aria-describedby="date-of-birth-hint"> <legend class="nds-date-input__legend"> Date of birth <span class="nds-date-input__required" aria-hidden="true"> * </span> </legend> <p class="nds-date-input__hint" id="date-of-birth-hint"> For example, 27 3 2007 </p> <div class="nds-date-input__boxes"> <div class="nds-date-input__part nds-date-input__part--day"> <label class="nds-date-input__part-label" for="date-of-birth-day"> Day </label> <div class="nds-date-input__control-wrap"> <input class="nds-date-input__control" type="text" inputmode="numeric" id="date-of-birth-day" name="date-of-birth-day" autocomplete="bday-day" /> </div> </div> <div class="nds-date-input__part nds-date-input__part--month"> <label class="nds-date-input__part-label" for="date-of-birth-month"> Month </label> <div class="nds-date-input__control-wrap"> <input class="nds-date-input__control" type="text" inputmode="numeric" id="date-of-birth-month" name="date-of-birth-month" autocomplete="bday-month" /> </div> </div> <div class="nds-date-input__part nds-date-input__part--year"> <label class="nds-date-input__part-label" for="date-of-birth-year"> Year </label> <div class="nds-date-input__control-wrap"> <input class="nds-date-input__control" type="text" inputmode="numeric" id="date-of-birth-year" name="date-of-birth-year" autocomplete="bday-year" /> </div> </div> </div></fieldset> Usage
<!-- wp:nds/date-input {} --><fieldset class="nds-date-input nds-date-input--typed" id="date-of-birth" aria-describedby="date-of-birth-hint"> <legend class="nds-date-input__legend"> Date of birth <span class="nds-date-input__required" aria-hidden="true"> * </span> </legend> <p class="nds-date-input__hint" id="date-of-birth-hint"> For example, 27 3 2007 </p> <div class="nds-date-input__boxes"> <div class="nds-date-input__part nds-date-input__part--day"> <label class="nds-date-input__part-label" for="date-of-birth-day"> Day </label> <div class="nds-date-input__control-wrap"> <input class="nds-date-input__control" type="text" inputmode="numeric" id="date-of-birth-day" name="date-of-birth-day" autocomplete="bday-day" /> </div> </div> <div class="nds-date-input__part nds-date-input__part--month"> <label class="nds-date-input__part-label" for="date-of-birth-month"> Month </label> <div class="nds-date-input__control-wrap"> <input class="nds-date-input__control" type="text" inputmode="numeric" id="date-of-birth-month" name="date-of-birth-month" autocomplete="bday-month" /> </div> </div> <div class="nds-date-input__part nds-date-input__part--year"> <label class="nds-date-input__part-label" for="date-of-birth-year"> Year </label> <div class="nds-date-input__control-wrap"> <input class="nds-date-input__control" type="text" inputmode="numeric" id="date-of-birth-year" name="date-of-birth-year" autocomplete="bday-year" /> </div> </div> </div></fieldset><!-- /wp:nds/date-input --> Usage
import { DateInput } from "@nigerian-design-standards/react";<DateInput legend="Date of birth" type="typed" hint="For example, 27 3 2007" required/> Usage
use NDS\Components\DateInput;echo DateInput::render([ 'legend' => 'Date of birth', 'type' => 'typed', 'hint' => 'For example, 27 3 2007', 'required' => true,]); Use a typed date input when people know the date, like a date of birth. Use the picker for appointments and dates they might choose from a calendar.
Borders change thickness, never opacity: 1px normally, 2px when active.
Empty boxes, with an example date in the hint.
The box in use has a 2px border.
One message for the group. Only the boxes at fault are highlighted.
Can’t be used. Avoid it where you can and say why instead.
The properties of the date input. The same in HTML, WordPress and React.
| Property | Type | Possible values | Description |
|---|---|---|---|
| legend | string |
| Required. The question, shown as the fieldset legend. |
| type | string |
| Typed boxes, or a text box with a calendar. |
| hint | string |
| Required. An example date in the format you expect. |
| minDate, maxDate | string |
| Picker only. Dates outside are unavailable in the calendar and rejected on submit. |
In code, the typed date input is a <fieldset> with a <legend>
and three <input type="text" inputmode="numeric"> boxes. Each
box has its own label and autocomplete of bday-day, bday-month or bday-year. The picker is a single text box (not type="date") and a separate calendar button that opens a dialog. Validate on
submit, not while people type.
| Part | Token | Contrast on the page |
|---|---|---|
| Container | Boxes · Form/Input field · border/default 1px, 2px when active | As Text input |
| Legend | Form/Legend · Label/medium · text/primary | 17.6:1 |
| Hint | Form/Hint · Body/small · text/secondary | 6.6:1 |
| Calendar button | Button, Icon only, Medium (40px), with icon/Calendar | Button tokens |
| Error | status/error/surface: text, icon and border | 4.9:1 |
| Selected day | action/primary/default · action/primary/text, bold | 5.8:1 |
Use the typed date input for a date of birth, with an example date in the hint.
For example, 14/10/2026
Don’t make people pick a date of birth from a calendar. Let them type it.
How a date input sits in a form.
How to write hints and error messages.
“For example, 27 3 2007”, in the format you expect.
“Date of birth must include a month”.
“Date of birth must be a real date”, not “Invalid date”.
“Appointment date must be on or after 27/10/2026”.
1 or 01, words for the month, and slashes, dashes, dots or spaces.
The same message appears at the top of the page and links to the field.
| Write | Don’t write | Why |
|---|---|---|
| Enter your date of birth | Date is required | Says what to do. |
| Date of birth must include a month | Incomplete date | Says what is missing. |
| Date of birth must be a real date | Invalid date | Plain words. |
| Date of birth must be in the past | Date cannot be in the future | Says what it must be. |
| Appointment date must be a weekday | Date not available | Says why. |
Meaning never relies on colour alone: an error has an icon and text, and the calendar uses bold outlines and strikethroughs for unavailable days.
| Key | What it does |
|---|---|
| Tab | Day → Month → Year in the date input. Text box → calendar button in the picker. |
| Shift + Tab | Moves back. |
| Enter or Space | On the calendar button, opens the calendar with focus on the selected date or today. On a day, chooses it and closes the calendar. |
Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.
Use Form/Date input from 01 Library – Foundations. Keep three boxes or one text box plus a calendar button.
Is this page useful?