Toast
Showing a temporary feedback message to the user.
Examples
The simplest way to create a toast is calling toast('the toast message')
. This will render a neutral toast.
Error toast
Use the error toast variant for any error that was not caused by the user, e.g. network connection lost.
Remove a toast
When adding a toast, all functions return the toast identifier. This identifier (or custom id passed in with the toast options) can be used to manually remove the toast before it disappears on its own.
Remove all toasts
All currently rendered toasts can also be removed.
API Reference
toast
Prop | Default | Description |
---|---|---|
error | - | (text: string, options?: ToastOptions$1 | undefined) => Id |
remove | - | (id: Id) => void |
removeAll | - | () => void |
ToastOptions
Prop | Default | Description |
---|---|---|
id? | a random unique id will be set and returned | Id Unique identifier for the toast (can be used for removing it prematurely). If a toast with this identifier already exists it will be removed before the new toast is added. |