Info
Neutral updates and things people should know.
Shows a message about the page or form people are on: a result, a problem or a heads-up. It stays in the page until the situation changes.
Updated
There is a problem
Alert
Usage
<div class="nds-alert nds-alert--error nds-alert--default" role="alert"> <div class="nds-alert__inner"> <p class="nds-alert__title"> There is a problem </p> <p class="nds-alert__message"> The selected file must be smaller than 5MB </p> </div></div> Add the NDS Alert block, or paste this markup into the Code editor
<!-- wp:nds/alert {} --><div class="nds-alert nds-alert--error nds-alert--default" role="alert"> <div class="nds-alert__inner"> <p class="nds-alert__title"> There is a problem </p> <p class="nds-alert__message"> The selected file must be smaller than 5MB </p> </div></div><!-- /wp:nds/alert --> Usage
import { Alert } from "@nigerian-design-standards/react";<Alert status="error" title="There is a problem" message="The selected file must be smaller than 5MB"/> Usage
use NDS\Components\Alert;echo Alert::render([ 'status' => 'error', 'title' => 'There is a problem', 'message' => 'The selected file must be smaller than 5MB',]); An alert sits in the page next to the content it describes and stays until the situation changes. Four statuses tell people how much the message matters.
Pick the status from what the message means, and use the same status for the same meaning across a service.
Neutral updates and things people should know.
Something completed. Keep any reference number on the page.
Needs attention soon, but doesn’t block people.
Something failed or must be fixed. Say what to do.
The properties of the nds-alert component. The same in HTML, WordPress and React.
| Property | Type | Possible values | Description |
|---|---|---|---|
| status | string |
| What the message means. Sets the strip, background and border colours. |
| layout | string |
| Compact has 8px padding, for one-line messages. |
| title | string |
| Optional. Says what happened in a few words. With a list, say how many problems. |
| message | string |
| One or two sentences. Say what to do next. |
| list | array |
| Optional. One link per problem, each going to its field. |
| reference | string |
| Optional. Shows a reference number large, so people can note it down. |
| link | object |
| Optional. One nds-link for the next step. |
In code, an alert added after the page loads uses role="alert" (error, warning) or role="status" (success, info). Start with a visually hidden “Error:”, “Warning:”,
“Success:” or “Information:” unless the title says it.
| Part | Token | Contrast on the page |
|---|---|---|
| Strip (6px) | status/info · success · warning · error /surface | Info 5.6:1 · Success 5.8:1 · Warning 4.9:1 · Error 4.9:1 |
| Background | status/… /bg | — |
| Border (top, right, bottom) | status/… /border, 1px | Decorative |
| Title, message, list | text/primary on status/… /bg | 15.9:1 or more |
| Link | nds-link (status/info/surface) | 5.0:1 on success |
| Padding · corners | 16px (8px compact) · radius/050 | — |
There were 2 problems
After a failed submit, say how many problems and link each one to its field.
Don’t use an alert for passing feedback like “Saved”. Use a toast, which disappears on its own.
Where an alert goes and how much room it takes.
How to write alert text. Say what happened and what to do, in plain words.
“The selected file must be smaller than 5MB.”
The title or a hidden status word says it. Never rely on the colour.
With a list: “There were 2 problems with your registration”.
Each list item goes to its field, with the same words as the field’s error.
One or two sentences. Link to the full detail.
A saved record is Success everywhere in the service.
| Write | Don’t write | Why |
|---|---|---|
| The selected file must be smaller than 5MB | Upload failed | Says what to fix. |
| There were 2 problems with your registration | Errors occurred | Says how many. |
| Request sent! Your reference number: BC-2026-04817 | Success! | Gives people what they need next. |
| Your session will end in 5 minutes | Warning: timeout | Plain words and a time. |
| Online renewals will be unavailable on Saturday | Scheduled maintenance | Says what and when. |
People have to notice an alert, so the status is in the words, never only in the colour.
| Key | What it does |
|---|---|
| Tab | Reaches the link in the alert, in reading order. The alert itself isn’t a Tab stop. |
| Shift + Tab | Moves back. |
| Enter | Follows the link. |
Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.
Use nds-alert from 01 Library – Foundations. Pick the Status and Layout, then turn on the title, list, reference or link you need. Don’t detach it.
Is this page useful?