Container API
Reference for the ToastContainer component.
The ToastContainer component is the host for all your toast notifications. It must be rendered once in your application tree.
Props
The ToastContainer component accepts the following props:
| Props | Type | Default | Description |
|---|---|---|---|
| autoClose | number | 3000 | Global default duration for auto-closing toasts. |
| closeButton | boolean | false | Whether to show a close button on all toasts by default. |
Usage
tsx1import { ToastContainer } from "react-toast-msg";23function Layout({ children }) {4 return (5 <>6 {children}7 <ToastContainer autoClose={5000} closeButton />8 </>9 );10}
IMPORTANT: Make sure to only render one
ToastContainerin your application to avoid duplicate notifications.
How is this guide?
Last updated on February 17, 2026