useToast
This hook is used to display and manage toasts. To learn how to make it usable and to see some examples, please check the Toast component page.
import { useToast } from "@medusajs/ui"
API Reference
Call Signature
useToast()
useToast return
Value | Type | Description |
---|---|---|
toast | function | Function used to display new toasts. For the toast options, please check the ToasterToast reference below. |
dismiss | function | Function used to hide a toast based on its id. |
toasts | ToasterToast[] | All the toasts that have been pushed to the context this hook was invoked in. |
Was this section helpful?
ToasterToast
Important type used when pushing or retrieving toasts. This extends the Radix UI Toast Root primitive type.
Value | Type | Description |
---|---|---|
id | string | |
title | ReactNode | |
description | ReactNode | |
variant | enum | Defaults to "info" |
action | ToastActionElement | |
disableDismiss | boolean |
Was this section helpful?