Force the stack into its expanded layout (does not pause timers)
maxVisibleToasts
number
3
Maximum number of toasts to display at once
hotkey
string[]
["altKey", "KeyT"]
Hotkey that moves focus to the toast region and expands the stack. Modifiers match KeyboardEvent boolean properties (e.g. "altKey"), other keys match event.code (e.g. "KeyT"). Modifiers you leave out must be up, so Alt+T does not also fire on Ctrl+Alt+T. Pass [] to disable
Update a toast in place, preserving its stack position; timeout restarts the countdown (0 keeps it open), omit it to keep the current countdown. Returns false if the toast no longer exists
close
(key: string)
void
Close a toast by its key
pauseAll
()
void
Pause all toast timers
resumeAll
()
void
Resume all toast timers
clear
()
void
Close all toasts (each toast animates out and fires its onClose)
subscribe
(fn: () => void)
() => void
Subscribe to queue changes, returns unsubscribe function
The default toast function provides convenient methods for showing toasts:
import { toast } from '@heroui/react';// Basic toast (auto-dismisses after 4 seconds by default)toast("Event has been created");// Variant methods (also auto-dismiss after 4 seconds by default)toast.success("File saved");toast.info("New update available");toast.warning("Please check your settings");toast.danger("Something went wrong");// With options. The returned id lets the action close its own toast.const eventId = toast("Event has been created", { description: "Your event has been scheduled for tomorrow", variant: "default", timeout: 5000, // Custom timeout: 5 seconds onClose: () => console.log("Closed"), actionProps: { children: "View", onPress: () => toast.close(eventId), }, indicator: <CustomIcon />,});// Update an existing toast in place (keeps its position in the stack).// Options you omit are inherited, so pass `timeout` to start a countdown// on a toast that was created persistent.const id = toast("Saving…", { timeout: 0 });toast.update(id, "Saved", { variant: "success", timeout: 4000 });// Promise support (automatically shows loading spinner). The loading toast// updates in place when the promise settles — same toast, same stack// position; the auto-dismiss countdown starts at that point.toast.promise( uploadFile(), { loading: "Uploading file...", success: (data) => `File ${data.filename} uploaded`, error: "Failed to upload file", });// Manual loading state (persistent toast - no auto-dismiss)const loadingId = toast("Creating event...", { isLoading: true, timeout: 0, // Persistent toast that doesn't auto-dismiss});// Later, update in place and start the auto-dismiss countdowntoast.update(loadingId, "Event created", { variant: "success", timeout: 4000 });// Queue methodstoast.close(key);toast.clear();toast.pauseAll();toast.resumeAll();
Landmark region: Toasts render in a labeled landmark reachable with F6; Alt + T moves focus straight to it. The hotkey is configurable via the hotkey prop and can be disabled by passing an empty array, and the region label can be overridden with aria-label
Keyboard: Tab reaches the controls of visible toasts, Escape collapses the expanded stack, and dismissing a focused toast moves focus to the nearest remaining toast
Screen readers: Each toast uses role="alertdialog" with its title and description linked; new toasts are announced automatically
Timers: Auto-dismiss pauses while the stack is hovered or focused, and while the page is in a background tab