rtm

Container API

Reference for the ToastContainer component.

Ask ChatGPT

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:

PropsTypeDefaultDescription
autoClosenumber3000Global default duration for auto-closing toasts.
closeButtonbooleanfalseWhether to show a close button on all toasts by default.

Usage

tsx
1import { ToastContainer } from "react-toast-msg";
2
3function Layout({ children }) {
4 return (
5 <>
6 {children}
7 <ToastContainer autoClose={5000} closeButton />
8 </>
9 );
10}

IMPORTANT: Make sure to only render one ToastContainer in your application to avoid duplicate notifications.

How is this guide?

Last updated on February 17, 2026