5Sponsor

Toast

Auto-dismissing toast notification

Terminal
toast-demo
No opentui live preview is registered for this example yet.

Installation

pnpm dlx shadcn@latest add @termcn/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
No opentui live preview is registered for this example yet.

API Reference

Toast

PropTypeDefault
messagestringrequired
variant"success" | "error" | "warning" | "info""info"
durationnumber3000
onDismiss() => voidundefined
iconstringundefined