Toast
primitiveTransient notifications. Fire from anywhere via useToast().
Installation
$pnpm dlx disenio add toastWire the provider
Wrap your app once. The provider portals into document.body so toasts always render on top.
app/layout.tsx
// app/layout.tsx
import { ToastProvider } from "@/components/ui/toast";
export default function RootLayout({ children }) {
return <ToastProvider>{children}</ToastProvider>;
}API
| Prop | Type | Default | Description |
|---|---|---|---|
| toast({ title }) | string | — | Headline of the toast. |
| toast({ description }) | string | — | Supporting body text. |
| toast({ tone }) | "neutral" | "accent" | "danger" | "neutral" | Visual emphasis. |
| toast({ duration }) | number (ms) | 4000 | Auto-dismiss timer. Pass 0 to keep until manually dismissed. |
| dismiss(id) | (id: string) => void | — | Dismiss a specific toast by id. |