Toast
Toast shows a brief message about an action that just happened, then disappears. Use it for confirmations that need no reply.
Uses the Alert matrix (owner reference, 2026-10-14): every status, appearance and size. Beta until design confirms the code-only floating shadow, motion and 400px width. Figma draws the static frame only. Everything on this page is implemented and tested.
Preview
Change the controls, then show a toast. It appears at the bottom-end of the window. Press F8 to move focus to the notifications region.
import { Button, ToastProvider, Toaster, useToast } from '@nuton/ui'
// Once, near the app root
<ToastProvider>
<App />
<Toaster />
</ToastProvider>
// Anywhere below it
const { toast } = useToast()
<Button onClick={() => toast({
status: 'success',
title: 'Lesson moved to Biology 101',
description: 'Photosynthesis basics is now in Biology 101.',
})}>Move lesson</Button>Installation
Availability
@nuton/ui and @nuton/tokens are private workspace packages and aren't published yet (D4, D12). Inside the Nuton monorepo, add them as workspace dependencies.
pnpm add @nuton/ui @nuton/tokens @remixicon/reactnpm install @nuton/ui @nuton/tokens @remixicon/reactyarn add @nuton/ui @nuton/tokens @remixicon/reactimport '@nuton/tokens/tokens.css'
import '@nuton/ui/styles.css'Wrap the app once in ToastProvider and place one Toaster inside it. Toast reuses the Alert styles, which are part of styles.css.
import { ToastProvider, Toaster } from '@nuton/ui'
export function Providers({ children }: { children: React.ReactNode }) {
return (
<ToastProvider>
{children}
<Toaster />
</ToastProvider>
)
}Usage
import { useToast } from '@nuton/ui'
const { toast } = useToast()
toast({ status: 'success', title: 'Notes saved', description: 'Cell respiration notes are in Biology 101.' })- Use a toast to confirm something people just did: saved, moved, copied, sent.
- Keep it short: a title of a few words and at most one sentence of description.
- Never put the only way to do something in a toast. It disappears, and screen-reader and keyboard users may not reach it in time. An Undo action must also exist elsewhere, named in
altText. - For information people must read or act on, use an Alert in the page or a Modal.
Variants and sizes
Toast takes the same statuses, appearances and sizes as Alert (see the Alert matrix). It defaults to the stroke appearance; one-line when there is no description, large when there is. The floating shadow and motion are code-only.
Statuses
toast({ title: 'Link copied', description: 'Share it with your study group.' })
toast({ status: 'information', title: 'AI Tutor is updating', description: 'Answers may take a little longer for a few minutes.' })
toast({ status: 'success', title: 'Notes saved', description: 'Cell respiration notes are in Biology 101.' })
toast({ status: 'warning', title: 'You’re offline', description: 'Changes are kept on this device until you reconnect.' })
toast({ status: 'error', title: 'Upload failed', description: 'The file is larger than 50 MB.' })| Part | Measurement |
|---|---|
| Toast | 400 wide (code-only). Alert sizes: xsmall 32 and small 36 tall (radius 8), large padding 14 (radius 12). Stroke by default (white, 1px Stroke/Soft-200), plus regular-shadow/medium on every appearance (code-only) |
| Viewport | Bottom-end, 16 from the edges, toasts 8 apart, newest at the bottom; full width with 12 at the edges below 480px |
| Icon · title · description | As Alert: 16 or 20px status icon; one-line text, or Label/Small title with Paragraph/Small description |
| Close | 16px (one-line) or 20px (large) icon in a 24 × 24 target |
| Timing | 5 seconds by default, paused while hovered or focused; at most 3 shown |
States and interactions
Notes saved
Cell respiration notes are in Biology 101.
Lesson moved to Trash
Mitosis
Upload failed
The file is larger than 50 MB.
With reduced motion the toast appears and disappears without sliding or fading. A swipe still follows the finger.
State tokens
Toast uses the Alert tokens on .nu-alert (status, appearance and size) and adds --nu-toast-shadow on .nu-toast, and --nu-toast-width and --nu-toast-inset on .nu-toast-viewport.
Figma gaps (code-only decisions)
- The alert reference has no floating toast. The shadow, width, placement, stacking limit and motion are code-only.
- The action is an
AlertActionin the toast's own text colour, as in the reference's "Button".
Composition examples
Undo after a delete
The lesson goes to Trash at once; the toast offers a shortcut to undo. altText tells screen-reader users where else to restore it.
- Photosynthesis basics
- Cell respiration
- Mitosis
toast({
title: 'Lesson moved to Trash',
description: lesson.name,
action: { label: 'Undo', altText: 'Restore it from Trash', onClick: () => restore(lesson) },
})Replace a toast
Pass the same id to update a toast in place, for example when an upload finishes.
const id = toast({ title: 'Uploading lecture-notes.pdf…', duration: 60000 })
// later
toast({ id, status: 'success', title: 'Upload complete', description: 'lecture-notes.pdf is in Biology 101.' })API reference
toast(options)
| Prop | Type | Default | Description |
|---|---|---|---|
status | 'error' | 'success' | 'warning' | 'neutral' | 'information' | 'neutral' | Colour, icon, status word and default priority. |
appearance | 'filled' | 'light' | 'lighter' | 'stroke' | 'stroke' | Same appearances as Alert. |
size | 'xsmall' | 'small' | 'large' | large with a description, else small | Same sizes as Alert. One-line sizes put the action at the end of the line. |
title | ReactNode | — | Bold first line. |
description | ReactNode | — | One short sentence. |
action | { label: string; onClick: () => void; altText?: string } | — | One action. altText (default: label) tells screen-reader users another way to do it. |
icon | ReactNode | false | — | Replaces the status icon; false hides it. |
statusLabel | string | false | — | Word read before the title. Defaults: Information, Success, Warning, Error. |
closeLabel | string | 'Close' | Accessible name of the close button. |
priority | 'polite' | 'assertive' | error → 'assertive', else 'polite' | How screen readers announce it. |
duration | number | provider (5000) | Milliseconds before it closes by itself. |
id | string | — | toast() only. Reuse to replace a showing toast. toast() returns the id. |
onClose | () => void | — | toast() only. Called when it closes for any reason. |
open · onOpenChange · …li props | Radix Toast.Root | — | Toast component only, for a controlled toast. |
ToastProvider, Toaster and useToast
| Prop | Type | Default | Description |
|---|---|---|---|
ToastProvider duration | number | 5000 | Default time before a toast closes. |
ToastProvider label | string | 'Notification' | Read before each toast by screen readers. |
ToastProvider limit | number | 3 | Most toasts shown at once; older ones close. |
ToastProvider swipeDirection | 'right' | 'left' | 'up' | 'down' | 'right' | Swipe direction that dismisses on touch. |
Toaster label | string | 'Notifications ({hotkey})' | Name of the notifications region. |
Toaster hotkey | string[] | ['F8'] | Keys that move focus to the region. |
useToast() | { toast, dismiss } | — | toast(options) shows one and returns its id; dismiss(id?) closes one or all. |
Accessibility
Keyboard
| Key | Behaviour |
|---|---|
| F8 | Moves focus to the notifications region |
| Tab | Moves through toasts and their buttons |
| Esc | Closes the focused toast |
| Enter / Space | Activates the action or close button |
Screen readers
Each toast is announced once through a live region: politely by default, assertively for errors. A hidden status word comes before the title. The region is a landmark named "Notifications (F8)".
Focus
A toast never takes focus by itself. When focus is inside the region the timer pauses. If a toast closes while it holds focus, focus moves to the region so it isn't lost; Tab then continues through the other toasts.
Contrast and colour
Text is Strong-950 on every tint. The icon shape and status word carry the status, not colour alone. Forced-colours mode draws a system border.
Touch and pointer
Close is 24 × 24 (WCAG 2.5.8). Swipe right to dismiss; the close button is the non-gesture alternative (WCAG 2.5.1). Hover pauses the timer (WCAG 2.2.1).
You must: keep toasts short, never make a toast the only way to reach an action, and give actions an altText that names the other way.
Figma mapping
| Figma layer | Figma value | Code |
|---|---|---|
| Reference matrix | 5 statuses × 4 appearances × 3 sizes | status, appearance (default stroke), size, plus the code-only shadow |
| Icon · text | Status icon · title · description | icon · title · description |
| "Button" | Text action | action (one) |
| Close | 16px close icon | Always shown, closeLabel |
Guidelines and related components
Use Toast for
- Confirming an action: saved, copied, moved
- Background events finishing, like an upload
- An optional undo
Don't use Toast for
- Errors people must fix in a form (use Alert or field errors)
- Long messages or several actions
- Anything people must read to continue
Do and don't
Notes saved
Your notes have been saved
We saved your cell respiration notes to Biology 101. You can find them under Notes, and they are also available offline on this device.
Lesson moved to Trash
Delete all lessons?