Feedback
Toast
A provider-driven notification system — wrap your app once, then call the useToast() hook from anywhere.
ToastProvideruseToastPreview
Loading demo
Usage
tsx
// app root
import { ToastProvider } from "@vesture/react";
<ToastProvider>
<App />
</ToastProvider>
// anywhere inside
import { useToast } from "@vesture/react";
const { toast } = useToast();
toast({ title: "Saved", description: "Your changes were saved.", variant: "success" });Behavior
- toast() returns a numeric id usable with dismiss(id).
- Auto-dismisses after duration ms (default 5000); pass 0 to disable.
- useToast() throws if called outside a ToastProvider.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | — | Required. |
| description | string | — | Optional body text. |
| variant | string | "default" | Accent color. |
| duration | number | 5000 | Auto-dismiss delay in ms. |