Components
Toaster
Toast notifications that stack in a corner.
<Toaster />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/toaster.jsonimport { Toaster } from "@/components/toaster"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
Put <Toaster /> once in your layout, then call toast() from anywhere. Toasts stack in the corner, with older ones tucked behind; hovering or focusing the stack fans them out and pauses the timer. It sits fixed in the bottom-right corner of the window and announces itself politely to screen readers.
import { Toaster, toast } from "@/components/toaster";
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<>
{children}
<Toaster />
</>
);
}
// Anywhere else:
toast("Changes saved", { description: "Your profile is up to date." });Props
| Prop | Type | Default | Description |
|---|---|---|---|
duration | number | 4000 | Milliseconds each toast stays. |
toast(title, { description? }) | function | Shows a toast and returns its id. | |
dismiss(id) | function | Removes a toast early. |
With reduced motion, toasts appear and stack without animating.