Toast API
Reference for the toast function and its methods.
The toast object provides several methods to trigger notifications with different styles.
toast(message, type, duration)
The main function for showing a toast.
| Parameter | Type | Default | Description |
|---|---|---|---|
| message | string | - | The message to display. |
| type | ToastType | 'default' | The style of the toast. |
| duration | number | 3000 | Time in ms before auto-close. |
Methods
toast.success(message, duration?)
Shorthand for toast(message, duration).
toast.error(message, duration?)
Shorthand for toast.error(message, duration).
toast.warning(message, duration?)
Shorthand for toast.warning(message, duration).
toast.default(message, duration?)
Shorthand for toast(message, duration).
Example
tsx1import { toast } from "react-toast-msg";23toast.success("Profile updated", { duration: 2000 });
How is this guide?
Last updated on February 17, 2026