useToast
Components and an API for displaying user toast messages.
Setup
To use toasts, provide the toast context somewhere high your component tree along with the ToastContainer
component.
The root layout component is probably the best place to set up the context.
Usage
To display a toast, first provide access to the Toast context using provideToast
. Then, you can use the useToast
function:
If the variant is not specified, the default is “success”.
An action can also be specified in the params to useToast
.