Force the stack into its expanded layout; does not pause timers
maxVisibleToasts
number
3
Maximum number of toasts to display at once (visual only)
hotkey
string[]
["altKey", "KeyT"]
Hotkey that moves focus to the region and expands the stack. Modifiers match KeyboardEvent boolean properties, other keys match event.code. Modifiers left out must be up. Pass [] to disable
scaleFactor
number
0.05
How much each toast behind the front one scales down
width
number | string
460
Width of the toast; numbers are pixels
queue
ToastQueue<T>
shared queue
Custom toast queue instance
children
ReactNode | ((props) => ReactNode)
default layout
Custom render function or children replacing the default toast layout
Update a toast in place, preserving its stack position; timeout restarts the countdown (0 keeps it open), omitting it keeps 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 animates out and fires its onClose
subscribe
(fn: () => void)
() => void
Subscribe to queue changes
destroy
()
void
Release pending timeouts and timers, for HMR and test teardown
The default toast function is bound to the shared queue used by <Toast.Provider>:
import {toast} from "@peakui/react";// Basic toast (auto-dismisses after 4 seconds by default)toast("Event has been created");// Variant methodstoast.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", timeout: 5000, onClose: () => console.log("Closed"), actionProps: {children: "View", onPress: () => toast.close(eventId)},});// Update in place (same toast, same stack position).const id = toast("Saving…", {timeout: 0});toast.update(id, "Saved", {variant: "success", timeout: 4000});// Promise support: a persistent loading toast settles in place.toast.promise(uploadFile(), { loading: "Uploading file...", success: (data) => `File ${data.filename} uploaded`, error: "Failed to upload file",});// Queue methodstoast.close(key);toast.clear();toast.pauseAll();toast.resumeAll();