Utility
Terminal
█
toast-demo █
Loading preview... █
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█Installation
$ pnpm dlx shadcn@latest add @termcn/opentui/toast
Usage
import { Toast } from "@/components/ui/toast";<Toast
variant="success"
message="Settings saved successfully."
duration={5000}
onDismiss={() => console.log("toast closed")}
/>Examples
Error with Longer Duration
Terminal
█
toast-error █
Loading preview... █
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█import { Toast } from "@/components/ui/toast";
export function ToastError() {
return (
<Toast
variant="error"
message="Deploy failed. Check logs."
duration={8000}
/>
);
}API Reference
Toast
| Prop | Type | Default |
|---|---|---|
message | string | required |
variant | "success" | "error" | "warning" | "info" | "info" |
duration | number | 3000 |
onDismiss | () => void | - |
icon | string | - |