Toast

Toast shows a brief message about an action that just happened, then disappears. Use it for confirmations that need no reply.

  • Beta
  • Accessibility
  • Figma Alert reference matrix (owner, 2026-10-14); Alert, Notification and Toast 3806:36330
  • packages/ui/src/components/Toast

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.

tsx
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.

bash
pnpm add @nuton/ui @nuton/tokens @remixicon/react
tsx
import '@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.

tsx
import { ToastProvider, Toaster } from '@nuton/ui'

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <ToastProvider>
      {children}
      <Toaster />
    </ToastProvider>
  )
}

Usage

tsx
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

PartMeasurement
Toast400 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)
ViewportBottom-end, 16 from the edges, toasts 8 apart, newest at the bottom; full width with 12 at the edges below 480px
Icon · title · descriptionAs Alert: 16 or 20px status icon; one-line text, or Label/Small title with Paragraph/Small description
Close16px (one-line) or 20px (large) icon in a 24 × 24 target
Timing5 seconds by default, paused while hovered or focused; at most 3 shown

States and interactions

Notes saved

Cell respiration notes are in Biology 101.

OpenSlides up and fades in over the base duration (code-only).

Lesson moved to Trash

Mitosis

Undo
PausedThe timer stops while the pointer is over any toast or focus is inside the region, and when the window loses focus.

Upload failed

The file is larger than 50 MB.

DismissedBy the close button, Escape, the action, a swipe right on touch, or the timer. Fades out (code-only).

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 AlertAction in 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

Replace a toast

Pass the same id to update a toast in place, for example when an upload finishes.

API reference

toast(options)

Toast options and Toast props
PropTypeDefaultDescription
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 smallSame sizes as Alert. One-line sizes put the action at the end of the line.
titleReactNode—Bold first line.
descriptionReactNode—One short sentence.
action{ label: string; onClick: () => void; altText?: string }—One action. altText (default: label) tells screen-reader users another way to do it.
iconReactNode | false—Replaces the status icon; false hides it.
statusLabelstring | false—Word read before the title. Defaults: Information, Success, Warning, Error.
closeLabelstring'Close'Accessible name of the close button.
priority'polite' | 'assertive'error → 'assertive', else 'polite'How screen readers announce it.
durationnumberprovider (5000)Milliseconds before it closes by itself.
idstring—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 propsRadix Toast.Root—Toast component only, for a controlled toast.

ToastProvider, Toaster and useToast

ToastProvider and Toaster props
PropTypeDefaultDescription
ToastProvider durationnumber5000Default time before a toast closes.
ToastProvider labelstring'Notification'Read before each toast by screen readers.
ToastProvider limitnumber3Most toasts shown at once; older ones close.
ToastProvider swipeDirection'right' | 'left' | 'up' | 'down''right'Swipe direction that dismisses on touch.
Toaster labelstring'Notifications ({hotkey})'Name of the notifications region.
Toaster hotkeystring[]['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

KeyBehaviour
F8Moves focus to the notifications region
TabMoves through toasts and their buttons
EscCloses the focused toast
Enter / SpaceActivates 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 layerFigma valueCode
Reference matrix5 statuses × 4 appearances × 3 sizesstatus, appearance (default stroke), size, plus the code-only shadow
Icon · textStatus icon · title · descriptionicon · title · description
"Button"Text actionaction (one)
Close16px close iconAlways 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

DoConfirm in a few words People can read it before it goes.

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.

Don'tWrite a paragraph It disappears before people finish reading.

Lesson moved to Trash

Undo
DoOffer undo as a shortcut Restoring from Trash still works if the toast is gone.

Delete all lessons?

Delete
Don'tAsk for a decision in a toast A choice that matters needs a Modal that waits for an answer.