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

Error summary

Lists every error on the page after a submit fails, with a link to each field, so people can find and fix them.

Updated

Live example

Error summary
Controls
Property Control What it does
Keep “There is a problem”
One link per error, with the same words as the field’s error

Overview

Show the error summary just above the submit button when a submit fails and there is at least one error. It lists every error as a link to its field, in the same words as the error under the field.

Use an error summary for

  • Any submit that fails with at least one error
  • One-question pages as well as long forms
  • Errors found when the form is checked on the server

Don’t use an error summary for

  • Checking while people type (check on submit)
  • Success messages (use an alert or a toast)
  • Errors without a message under the field (show both)

Examples

It looks the same for one error or many. Only the number of links changes.

One error

Still shown for a single error, so people always find it.

Specifications

The properties of the error summary. The same in HTML and React.

Error summary properties
Property Type Possible values Description
title string
  • There is a problem default
Optional. Defaults to “There is a problem”. Keep it.
errors array text + href Required. One link per error, going to its field, in the same order as the fields.

The summary has role="alert" and tabindex="-1". After a failed submit, move focus to it and start the page <title> with “Error: ”. Each link targets the field’s id (for radios or checkboxes, the first option in the set).

Tokens

Error summary tokens and contrast
Part Token Contrast on the page
Container surface/canvas · status/error/surface border, 2px (border/width/thick) 4.9:1
Icon 20px (size/icon/md) status/error/surface disc · icon/exclamation (text/white) at 12px (spacing/150) 4.9:1 · exclamation 4.9:1
Title Title/medium · text/primary 17.6:1
Links Body/small-emphasized · status/error/surface, underlined 4.9:1
Padding spacing/300 — 24px on every side —
Gaps spacing/200 16px (title block to links) · spacing/100 8px (icon to title) —
Width Fills the form column (560px in the component) —

Use cases

Do

List every error, in the same words as the error under the field.

Don’t

Don’t give a vague message. Each link names the field and how to fix it.

Layout

Where the error summary goes and how it behaves.

Just above the submit button
Where people pressed it, after a submit fails.
Fills the form column
The same width as the fields.
Same order as the fields
Top to bottom, so people fix them in order.
Errors stay under the fields
Each link goes to the message under its field.
Updated on each submit
Remove it when the form is submitted with no errors.

Copywriting

How to write the title and error links.

Keep the title
“There is a problem”.
Match the field error

Use the same words in the summary as under the field.

Name the field and the fix
“Enter your first name”.
Be calm
Not “Oops”, “Sorry”, “Please” or “Invalid”.
Don’t blame

“Date of birth must be in the past”, not “You entered an invalid date”.

Prefix the page title

When there are errors, start the page title with “Error: ”, for example “Error: Contact us”.

Examples

Error summary copywriting examples
Write Don’t write Why
Enter your first name This field is required Names the field and the fix.
Enter an email address in the correct format, like name@example.com Invalid email Says how to fix it.
Select how you want to be contacted Please select an option Says what to do.
Business name must be 120 characters or fewer Too many characters Gives the limit.
There is a problem Oops! Something went wrong Calm and plain.

Accessibility

After a failed submit, focus moves to the summary, so people hear the errors first.

Keyboard interaction for the error summary
Key What it does
Tab Moves through the error links in order.
Shift + Tab Moves back.
Enter Follows the link and moves focus to the field.
  • Focus moves to the summary after a failed submit, and the page title starts with “Error: ” (WCAG 3.3.1, 2.4.2).
  • role="alert" makes screen readers announce it (WCAG 4.1.3).
  • Each link goes to its field and uses the same words as the field’s error (WCAG 2.4.4, 3.3.3).
  • Errors use an icon, words, and a red border, never colour alone (WCAG 1.4.1).
  • Title 17.6:1; links and border 4.9:1 (WCAG 1.4.3, 1.4.11).

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 nds-error-summary from 01 Library – Foundations. Keep the title and link each error to its field. Don’t detach it.

References

Feedback

Report a problem with this page