rtm

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:

PropsTypeDefaultDescription
autoClosenumber | boolean3000Global default duration for auto-closing toasts. Set to false to disable.
closeButtonbooleanfalseWhether to show a close button on all toasts by default.
pauseOnHoverbooleantruePauses the auto-close timer while a user hovers a toast.

Usage

tsx
import { ToastContainer } from 'react-toast-msg'; function Layout({ children }) { return ( <> {children} <ToastContainer autoClose={5000} closeButton pauseOnHover /> </> ); }

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

How is this guide?

Last updated on April 22, 2026