Toast
A toast notification component with stacking, hover pause, and progress indicators
Installation
Import
Types
Click each button to see the corresponding toast type. Each type has a unique icon and semantic meaning.
Title Only
Simple toasts with just a title are perfect for quick, self-explanatory notifications.
With Description
Descriptions provide additional context below the title. Use them for details that help users understand what happened or what to do next.
With Action
Add interactive buttons to toasts for undo actions, navigation, or explicit dismissal.
Promise Toast
Promise toasts automatically handle loading, success, and error states. The toast updates when the promise resolves or rejects.
Dismiss Toast
Store toast IDs to dismiss them programmatically. Use dismissAll() to clear all toasts at once.
Active toasts: 0
Duration
Set custom durations for different notification types. Use duration: 0 for persistent toasts that require manual dismissal.
Infinite Duration
Use duration: Infinity for toasts that require explicit user dismissal. Always provide a close action.
With Progress Bar
Enable showProgress on Toaster, or use progress option per toast. Hover over the toast to pause the timer.
Stacking
Multiple toasts stack with a subtle offset. Hover over the stack to expand and view all notifications. The default limit is 3 visible toasts.
Variant
Use the variant option to customize the background color scheme of each toast independently from its type.
Compact Layout
Use layout="compact" for minimal, single-line toasts. Ideal for brief confirmations and high-frequency notifications.
Position
Click each button to see a toast in that position. The swipe direction to dismiss adapts based on position (horizontal for corners, vertical for center).
Multiple Toasters
Multiple Toaster instances with different IDs operate independently. Use toast.use("id") to target specific instances.
System Notifications (Top-Left)
For system-level alerts and background processes
User Actions (Bottom-Right)
For user-triggered action confirmations
Html Content
Both title and description automatically detect HTML tags and render them appropriately. Plain strings are rendered as text, while strings with HTML tags are rendered as HTML.
Custom Slots
Use compound components to customize each part of the toast. This example uses emoji icons and custom button styling.
Use Effect
This example shows proper toast integration with React effects, including state management and cleanup.
Status: Monitoring inactive
Toast: Hidden
Action count: 0
Playground
Position
Variant
Type
Layout
Title Length
Description Length
API reference
| ToasterProps | Type | Default |
|---|---|---|
id | string |undefined | "default" |
position | undefined |"top-left" |"top-center" |"top-right" |"bottom-left" |"bottom-center" |"bottom-right" | "bottom-right" |
container | HTMLElement |null |undefined | - |
label | string |undefined | "Notifications" |
portal | boolean |undefined | true |
offset | number |undefined | 16 |
duration | number |undefined | 5000 |
visibleToasts | number |undefined | 3 |
className | string |undefined | - |
children | ReactNode | - |
showProgress | boolean |undefined | false |
layout | undefined |"default" |"compact" | "default" |
ref | ((instance: HTMLDivElement |null) => void) |RefObject<HTMLDivElement> |null |undefined | - |