Advanced Usage
Customize your toasts with durations, close buttons, and more.
Beyond simple messages, you can customize how your toasts behave and look.
Custom Duration
You can override the default auto-close duration by passing a third argument to the toast function (in milliseconds).
tsx
Disable Auto Close
If you have an important message that requires the user's explicit attention, you can prevent the toast from closing automatically by passing autoClose: false. This will automatically force the close button to show, ensuring the user can still dismiss it.
tsx
Pause On Hover
Auto-closing toasts pause their timer while hovered by default, which gives users time to read longer messages without changing your API calls.
tsx
If you want a toast to keep closing on schedule even while hovered, disable it per toast or on the container.
tsx
Manual Close Button
You can enable or disable the close button globally in ToastContainer or per-toast via the toast methods.
tsx
TIP: Use shorter durations for simple notifications and longer durations for critical errors that require user attention.
Global Configuration
The ToastContainer accepts props that apply to all toasts.
tsx
autoClose: Default duration for all toasts in milliseconds. Passfalseto disable auto-closing globally.closeButton: Whether to show a close button by default.pauseOnHover: Pauses the auto-close timer while a user hovers a toast. Defaults totrue.
Promises
Handle asynchronous operations seamlessly with toast.promise. It manages loading, success, and error states for you.
tsx
How is this guide?
Last updated on April 22, 2026