Components
Timed Toast
A toast with a countdown bar that pauses on hover.
<TimedToast open={open} title="Upload complete" onClose={close} />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/timed-toast.jsonimport { TimedToast } from "@/components/timed-toast"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
A toast with a bar along its edge that counts down the time left. Hovering or focusing it pauses the countdown. It sits fixed in the bottom-right corner of the window and announces itself politely to screen readers.
import { TimedToast } from "@/components/timed-toast";
export function UploadDone({ open, onClose }: { open: boolean; onClose: () => void }) {
return <TimedToast open={open} title="Upload complete" description="report.pdf" onClose={onClose} />;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | Shows the toast. | |
title | string | The headline. | |
description | string | A second line. | |
onClose | () => void | Called when time runs out or it's dismissed. | |
duration | number | 5000 | Milliseconds before it closes. |
color | string | "#818cf8" | Colour of the countdown bar. |
With reduced motion, the bar is hidden but the toast still closes on time.