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

Toast

A short, temporary message that confirms an action or reports a change, without taking people away from what they’re doing.

Updated

Live example

Toast

Changes saved

Your profile details have been updated.

Controls
Property Control What it does
Info, success, warning or error
Show title
Turn off for a one-line message
What happened, in one or two sentences

Overview

A toast is a short message about something that just happened. It appears above the page at the top right and people can carry on without acting on it. Four states tell people what kind of message it is.

Use a toast for

  • Feedback on something people just did: saved, copied, sent
  • A neutral update they may want to know about
  • An action that failed and can be tried again, like an upload

Don’t use a toast for

  • Problems in a form people must fix (use an alert)
  • A notice for the whole site, like planned downtime (use a banner)
  • Anything people must read or act on, like payments or deadlines (use an alert or the page)

States

Pick the state from what the message means, and use the same state for the same meaning across a service.

Service update

Online renewals will be unavailable on Saturday.

Info

A neutral update people may want to know about.

Changes saved

Your profile details have been updated.

Success

Something people just did worked.

Warning

Something to watch that doesn’t block people.

Error

Something failed. Say what to do next.

Specifications

The properties of the nds-toast component. The same in HTML, WordPress and React.

Toast properties
Property Type Possible values Description
state string
  • info default
  • success
  • warning
  • error
What the message means. Sets the icon and its colour.
title string
  • any text
Optional. A few words. Leave it out for a one-line message.
message string
  • any text
One or two sentences. For problems, say what to do next.

In code, add the toast to a live region that is already on the page: role="status" for success and info, role="alert" for warning and error. Start the text with a visually hidden “Success:”, “Information:”, “Warning:” or “Error:”. The close button is a <button> with aria-label="Close notification".

Tokens

Toast tokens and contrast
Part Token Contrast on the page
Container surface/canvas · border/subtle · 1px · radius/050 Border is decorative
Status icon info · success · warning: 20px Fill /surface · error: 16px status/error/surface disc + 12px icon/exclamation (text/white) Info 5.6:1 · Success 5.8:1 · Warning 4.9:1 · Error disc 4.9:1 · Exclamation 4.5:1
Title Label/medium · text/primary 17.6:1
Message Body/small · text/secondary 6.6:1
Close icon (20px) icon/close · text/primary 17.6:1
Padding · gaps spacing/300 24px (top, bottom) · spacing/150 12px (sides, column gap) · spacing/050 4px (title to message) —
Shadow Not a style yet: y 2, blur 4, spread -1 at 2% · y 5, blur 13, spread -5 at 5% —

Use cases

Do

Success:

Your reference number has been copied.

Confirm something people just did, in a few words.

Don’t

Don’t put form errors in a toast. It disappears before people fix them. Use an alert above the form.

Layout

Where a toast appears and how much room it takes.

Top right
About 16px in from the top and right edge of the page, above the content.
Never over the task
Don’t cover the field, link or button someone is using.
One at a time
Show a single toast. If several things happen together, say them in one message.
400px wide
24px padding above and below, 12px at the sides. 4px corners.
Narrow screens
Fill the width between the 16px page margins, at the top (proposed).

Copywriting

How to write toast text. Say what happened and, for problems, what to do, in plain words.

Say what happened
“Changes saved”, not “Success!”.
Put the state in words

A hidden state word or the title says it. Never rely on the icon or colour.

Say what to do next

For errors: “We couldn’t upload your file. Check your connection and try again.”

Nothing critical

Anything people must read or act on goes in an alert or on the page.

Keep it short

A title and one or two sentences. People see it for a few seconds.

Same state, same meaning

A saved record is Success everywhere in the service.

Examples

Toast copywriting examples
Write Don’t write Why
Changes saved Success! Says what worked.
Your reference number has been copied Copied to clipboard successfully Shorter, and says what was copied.
We couldn’t upload your file. Check your connection and try again Error 500 Says what failed and what to do.
Connection is slow. Some changes may take longer to save Network issue detected Plain words, and what it means for people.
Online renewals will be unavailable on Saturday Scheduled maintenance Says what and when.

Accessibility

A toast appears without people asking for it, so it is announced and never takes focus.

Keyboard interaction for toasts
Key What it does
Tab Reaches the close button in reading order. The toast itself isn’t a Tab stop.
Shift + Tab Moves back.
Enter or Space Closes the toast.
  • The state is in the words: a hidden “Success:”, “Information:”, “Warning:” or “Error:” starts the text (WCAG 1.4.1).
  • Toasts are announced with role="status" (success, info) or role="alert" (warning, error) (WCAG 4.1.3).
  • A toast never moves focus and never covers what people are using (WCAG 2.4.11).
  • The close button has at least a 24 × 24 click area (WCAG 2.5.8). Warnings and errors never close on their own (WCAG 2.2.1).
  • Title 17.6:1 and message 6.6:1 on the toast. Every status icon is 3:1 or more (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 the nds-toast component from 01 Library – Foundations. Don’t detach it.

References

Feedback

Report a problem with this page