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

ValueTypeDescription
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.
toastsToasterToast[]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.

ValueTypeDescription
idstring
titleReactNode
descriptionReactNode
variant
enum
Defaults to "info"
action
ToastActionElement
disableDismissboolean
Was this section helpful?