Toast component for displaying brief messages
For more examples, visit the Storybook.
Before usage, ensure you have installed the sonner
package:
Add the <Toaster />
component to your application, typically in your main layout or App component:
<Toaster />
Props(Please refer to the sonner documentation for detailed props and options.)
toast()
Props(Please refer to the sonner documentation for detailed props and options.)
For more examples, visit the Storybook.
Before usage, ensure you have installed the sonner
package:
Add the <Toaster />
component to your application, typically in your main layout or App component:
<Toaster />
Props(Please refer to the sonner documentation for detailed props and options.)
toast()
Props(Please refer to the sonner documentation for detailed props and options.)
For more examples, visit the Storybook.
Initialize the Toaster service to your application, typically in your main layout or App component:
Use the ToastService
to show a toast message:
ToasterOptions
Gets or sets the position of the toaster on the screen (e.g., “top-right”, “bottom-left”).
ToastOptions
Gets or sets the type of toast (e.g., “error”).
Gets or sets the description text of the toast.
Gets or sets whether the toast should have a close button.
Gets or sets the duration in milliseconds for which the toast should be visible.
ToastService
MethodsInitializes the toaster service with the specified options.
Shows a toast message with the specified text and options.
Dismisses a toast message by its ID.