Skip to main content

Overview

🔔
Settings saved
Payment successful
Receipt sent to your email.
Storage almost full
Free up space to continue syncing.
Upload failed
The file size exceeds the 10 MB limit.
Toast is a non-blocking notification triggered by user actions or system events. It auto-dismisses after a timeout (default 4s) and supports semantic variants. Multiple toasts stack when active.

Installation


Setup

Add <ToastProvider> and <Toaster> to your app root once:

Usage


Variants

Default

🔔
Settings saved

With Description

Success

Payment successful
Receipt sent to your email.

Warning

Error

With Action

🔔
Message deleted

API Reference

toast()

string
Primary notification message (required).
string
Supporting description shown below the title.
string
default:"default"
Semantic color variant. Values: default · success · warning · error · info
number
default:"4000"
Auto-dismiss delay in milliseconds.
ToastActionElement
Optional action element (e.g. an Undo button).

Toaster

string
default:"bottom-right"
Stack position on screen. Values: top-left · top-center · top-right · bottom-left · bottom-center · bottom-right

Accessibility

  • Toast uses role="status" (or role="alert" for error variant) so screen readers announce it
  • aria-live="polite" is used for non-critical toasts; aria-live="assertive" for errors
  • Auto-dismiss is paused when the user hovers or focuses the toast
  • Action buttons inside toasts are keyboard-navigable
  • Dismiss button has an aria-label="Close" for screen readers

Do’s & Don’ts

Do

  • Use Toast for transient feedback after user actions (save, delete, upload)
  • Keep the title short — one sentence or fewer
  • Include an action when the user may want to undo
  • Use variant="error" for failures that need immediate attention

Don't

  • Don’t use Toast for persistent alerts — use Alert component instead
  • Don’t stack more than 3 toasts simultaneously
  • Don’t use Toast for information that requires a user decision — use Modal
  • Don’t make the duration too short for toasts with descriptions (use ≥5s)