Toast
toastStacked notifications you fire from anywhere with toast.success(), toast.error() or toast.promise(). They fan behind the newest one, expand on hover, take an undo action and swipe away. Mount one Toaster at the root.
"use client";
import { Button } from "@/components/forme/button/button";
import { toast } from "@/components/forme/toast/toast";
// The site renders one <Toaster /> in its root layout, as your app should. A
// second one here would show every toast twice.
export function ToastDemo() {
return (
<div className="flex flex-wrap gap-2">
<Button
size="small"
variant="secondary"
onClick={() =>
toast.success("Invoice sent", { description: "INV-2041 was emailed to Acme Inc." })
}
>
Success
</Button>
<Button
size="small"
variant="secondary"
onClick={() =>
toast("Project archived", {
description: "forme-web is hidden from the dashboard.",
action: { label: "Undo", onClick: () => toast.info("Restored forme-web") },
})
}
>
With undo
</Button>
<Button
size="small"
variant="secondary"
onClick={() =>
toast.error("Payment failed", {
description: "The card ending 4242 was declined.",
})
}
>
Error
</Button>
<Button
size="small"
variant="secondary"
onClick={() =>
toast.promise(new Promise((resolve) => setTimeout(resolve, 1800)), {
loading: { title: "Deploying…", description: "Building forme-web" },
success: { title: "Deployed", description: "Live at forme.dev" },
error: "The deploy failed",
})
}
>
Promise
</Button>
</div>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
Usage
import { Toaster, toast } from "@/components/forme/toast/toast";
// Once, near the root of the app:
<Toaster />
// Anywhere, even outside React:
toast.success("Invoice sent", { description: "acme@example.com" });When to use
Reach for it
- Confirming something that just happened, and offering Undo for it.
- Background results: a save that finished, an upload that failed with a Retry action.
Use something else
- Errors a person has to fix in a form — put those beside the field.
- Anything that must not be missed; toasts leave on their own after
timeout, 5 seconds by default.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
Toaster
Render once, near the root of the app. Toasts appear bottom-right.
| Prop | Type | Default | Description |
|---|---|---|---|
limit | number | 3 | How many stay visible. Older ones are pushed out. |
timeout | number | 5000 | Default lifetime in ms. 0 keeps toasts until dismissed. |
className | string | — |
Accessibility
- Toasts are announced as they arrive, and the dismiss button is labelled.
- Hovering or focusing the stack expands it and holds every toast open, so each can be read and reached.
Motion
- Stacked toasts fan behind the newest one and spread out when the stack is hovered.
- Swipe down or right to dismiss.
Responsive behaviour
- Bottom-right and 22rem wide from
sm; below that the stack spans the screen with a 1rem margin.
Related


Alert
An inline message in four states, with a matching icon, an optional title and room for an action. Only the destructive state interrupts a screen reader; the rest wait their turn.
feedback

Empty State
What a list, table or page shows before it has anything in it: a stacked icon, a title, one sentence and the next action. So an empty screen reads as a start rather than an error.
feedback

Loader
Eight loading indicators — ring, dots, bars, a dot-grid wave and orbit, a terminal braille spinner, a figure-eight comet and sparkles. Pure CSS in a server component, sized in em and coloured by currentColor, with a still frame under reduced motion.
feedback