1. framework components
  2. toast

Toast

Display brief messages to users.

Usage

This component acts as a Singleton - meaning you only implement a single instance (typically at the root scope of your app) and then reuse it over and over. To do this, implement the <Toast.Group> at the root scope of your app (the root layout), and use a shared createToaster() instance to trigger messages to that group from anywhere in your application.

Type

Placement

Action

Closable

Meta

Promise

API Reference

Root

txt
card p-3 w-full md:w-md ring flex items-center gap-2 preset-filled-surface-50-950 ring-surface-200-800 data-[type=success]:preset-filled-success-500 data-[type=warning]:preset-filled-warning-500 data-[type=error]:preset-filled-error-500
PropDefaultType
toastOmit<Options<any>, "id" | "parent">

element((attributes: HTMLAttributes<"div">) => Element) | undefined

Render the element yourself

Context

PropDefaultType
children(toast: ToastApi<PropTypes, any>) => ReactNode

Group

PropDefaultType
toasterToastStore<any>

children((toast: ToastProps<any>) => Element | null) | undefined

element((attributes: HTMLAttributes<"div">) => Element) | undefined

Render the element yourself

Message

txt
flex-1
PropDefaultType
element((attributes: HTMLAttributes<"div">) => Element) | undefined

Render the element yourself

Title

txt
font-medium text-sm
PropDefaultType
element((attributes: HTMLAttributes<"div">) => Element) | undefined

Render the element yourself

Description

txt
text-sm
PropDefaultType
element((attributes: HTMLAttributes<"div">) => Element) | undefined

Render the element yourself

ActionTrigger

txt
btn preset-filled
PropDefaultType
element((attributes: HTMLAttributes<"button">) => Element) | undefined

Render the element yourself

CloseTrigger

txt
btn-icon hover:preset-tonal
PropDefaultType
element((attributes: HTMLAttributes<"button">) => Element) | undefined

Render the element yourself

View page on GitHub