How to build an accessible Toast in React

Toasts render into a labelled region; non-critical ones use role="status" with aria-live="polite", while destructive variants escalate to role="alert" with aria-live="assertive" so urgency is conveyed without stealing focus.

When to use a Toast

When not to use it

Keyboard interactions

Role status, verified at WCAG 2.2-AA.

Common mistakes

Avoid: toast({ title: "Delete this account?", duration: 0 })

Prefer: <AlertDialog title="Delete this account?" />

Toasts auto-dismiss and are easy to miss; a destructive decision needs a blocking dialog the user must confirm

Example

const { toast } = useToast()
toast({ title: "Saved", variant: "success" })

See the full Toast reference →