Skip to content

Official government website An official website of the Federal Government of Nigeria

How you know
Federal Ministry of Communications, Innovation & Digital Economy Nigerian Design Standards

Date input

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

Live example

Date input
Date of birth

For example, 27 3 2007

Controls
Property Control What it does
Default (empty), active, error or disabled
The legend, as a question
Typed boxes, or a box with a calendar

Overview

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.

Use a date input for

  • Dates people know, like a date of birth (typed)
  • Appointments, bookings and start dates (picker)
  • Date ranges, as two pickers: “Start date” and “End date”

Don’t use a date input for

  • An approximate date (ask for month and year, or use a text box)
  • A date of birth with a calendar
  • Dropdowns for day, month and year

States

Borders change thickness, never opacity: 1px normally, 2px when active.

Date of birth

For example, 27 3 2007

Default

Empty boxes, with an example date in the hint.

Date of birth

For example, 27 3 2007

Active

The box in use has a 2px border.

Date of birth

For example, 27 3 2007

Error

One message for the group. Only the boxes at fault are highlighted.

Date of birth

For example, 27 3 2007

Disabled

Can’t be used. Avoid it where you can and say why instead.

Specifications

The properties of the date input. The same in HTML, WordPress and React.

Date input properties
Property Type Possible values Description
legend string
  • any text
Required. The question, shown as the fieldset legend.
type string
  • typed default
  • picker
Typed boxes, or a text box with a calendar.
hint string
  • For example, 27 3 2007
Required. An example date in the format you expect.
minDate, maxDate string
  • DD/MM/YYYY
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.

Tokens

Date input tokens and contrast
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 cases

Do

Date of birth

For example, 27 3 2007

Use the typed date input for a date of birth, with an example date in the hint.

Don’t

For example, 14/10/2026

Don’t make people pick a date of birth from a calendar. Let them type it.

Layout

How a date input sits in a form.

Boxes stay on one line
Day 64, Month 64 and Year 80 wide on every device. Don’t stretch them.
Picker fills the column
The calendar button stays 40 × 40 beside the text box.
Calendar opens below
336 wide, so it fits a 375 screen. On desktop it overlays the content under it.
Separate tab stops
Each box, the text box and the calendar button.
Never auto-advance
Don’t move focus between boxes or reformat while people type.

Copywriting

How to write hints and error messages.

Show an example date

“For example, 27 3 2007”, in the format you expect.

Use the question’s words

“Date of birth must include a month”.

Say what is wrong

“Date of birth must be a real date”, not “Invalid date”.

Give the limit

“Appointment date must be on or after 27/10/2026”.

Accept what people type

1 or 01, words for the month, and slashes, dashes, dots or spaces.

Repeat it in the error summary

The same message appears at the top of the page and links to the field.

Examples

Date input copywriting examples
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.

Accessibility

Meaning never relies on colour alone: an error has an icon and text, and the calendar uses bold outlines and strikethroughs for unavailable days.

Keyboard interaction for date input
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.
  • The date input uses a fieldset with a legend, and each box has its own label (WCAG 1.3.1, 3.3.2).
  • The calendar is a dialog; each day is a button named in full: “Wednesday 14 October 2026” (WCAG 4.1.2).
  • Arrows move by day or week, Page Up/Down move by month, and Esc closes the calendar (WCAG 2.1.1).
  • Errors use an icon and text; only boxes at fault get aria-invalid (WCAG 1.4.1, 3.3.1).
  • The calendar is never the only way in; people can always type the date.

For developers

Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.

For designers

Use Form/Date input from 01 Library – Foundations. Keep three boxes or one text box plus a calendar button.

References

Feedback

Report a problem with this page