ToastApi: {
    dismiss: (toast: HTMLElement) => void;
    dismissAll: () => void;
    show: (message: string, options?: ToastOptions) => HTMLElement;
}

Imperative handle returned by enhanceToast. Toasts are transient and many can be shown at once, so unlike the other overlays this API is show/dismiss rather than open/setOpen; each toast still reports through onOpenChange/hl:open-change.

Type declaration

  • dismiss: (toast: HTMLElement) => void

    Dismiss a toast element previously returned by show (or server-rendered).

  • dismissAll: () => void

    Dismiss every toast currently in the region.

  • show: (message: string, options?: ToastOptions) => HTMLElement

    Show a toast with message and return its element.