Config
Configure defaults for every toast with toast.config(partial). Optional framework <Toaster /> wrappers accept the same keys as props.
| Key | Type | Default | Description |
|---|---|---|---|
position | ToastPosition | "top-right" | Default stack corner. Per-toast position overrides |
theme | "light" | "dark" | "system" | "light" | Color scheme |
duration | number | 4000 | Default auto-close ms when autoClose is true |
autoClose | boolean | true | Default automatic dismissal |
closeButton | boolean | true | Show close button by default |
dismissible | boolean | true | Allow dismiss by default |
richColors | boolean | false | Default tinted success/error/warning/info surfaces. Per-toast richColors overrides |
visibleToasts | number | 3 | Max visible in the stack |
expand | boolean | false | Always expand stack (else expand on hover) |
gap | number | 12 | Gap between expanded toasts (px) |
offset | number | string | 16 | Distance from viewport edge |
dir | "ltr" | "rtl" | "auto" | "auto" | Text direction |
pauseOnHover | boolean | true | Pause timers while hovering the stack |
resetTimerOnHover | boolean | false | Reset timer and progress together on hover |
pauseOnWindowBlur | boolean | true | Pause timers when the window loses focus |
progressBar | boolean | true | Show duration progress bar when auto-closing |
toasterClassName | string | - | Class on the toaster container |
style | object | - | Inline styles on the toaster container |
toast.config({
position: "top-right",
theme: "light",
duration: 4000,
autoClose: true,
richColors: true,
visibleToasts: 3,
expand: false,
progressBar: true,
pauseOnHover: true,
resetTimerOnHover: false,
});autoClose decides whether a toast auto-dismisses. Prefer autoClose: false for sticky toasts instead of duration: Infinity.