Toast
A succinct message that is displayed temporarily.
Installation
pnpm dlx shadcn@latest add @sui/toastInstall with the shadcn CLI or use the shared @workspace/ui package. Follow the installation guide to configure the registry, load styles, and choose import aliases.
Usage
import { toast } from "@workspace/ui/components/toast"toast.add({
title: "Event created",
description: "Sunday, December 3 at 9:00 AM",
})Types
Set the type option to render a status icon. The built-in renderer recognizes
success, info, warning, error, and loading.
Action
Pass button props with actionProps to render an action.
const id = toast.add({
title: "Event created",
actionProps: {
children: "Undo",
onClick() {
toast.close(id)
},
},
})Promise
Use toast.promise to update one toast as an asynchronous task moves through
loading, success, and error states.
Position and colors
Toaster shows toasts at the top center by default; stacks grow away from that edge and swipe toward it to dismiss. Success, info, warning and error toasts are tinted with their status color; with glass or frosted on Toaster, the color becomes the material tint. Set position or colorful={false} to change either.
<Toaster position="bottom-right" colorful={false}>
{children}
</Toaster>| Prop | Type | Default |
|---|---|---|
position | "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | "top-center" |
colorful | boolean | true |
feedback | FeedbackOption | Follows FeedbackProvider; haptics for success, warning and error |
API Reference
See the Base UI Toast documentation for details about manager options, stacking, swipe dismissal, and the primitive API.