Countdown
Counts down to a moment, or for a number of seconds, in days, hours, minutes and seconds, with digits that roll to each new value. Use it for a sale, a launch or a session that ends. For a number that changes with data use the animated number.
Install
npx shadcn@latest add @thrum-pro/countdownThis is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
target | Date | – | The moment the count reaches zero. |
duration | number | – | Seconds to count down from the moment it mounts, when there is no target. |
now | Date | – | The time for the first render, so server and browser show the same number. Without it a target countdown shows dashes until the clock is read. |
paused | boolean | Default false | Stop the clock where it is. A duration countdown resumes from there; a target countdown jumps to the real time. |
format | "compact" | "labelled" | Default "compact" | compact is one line, 02:14:09. labelled puts each unit in a box with its name under the digits. |
days | boolean | – | Show a days unit. By default it shows while a day or more is left; without it the hours count past 24. |
locale | string | Default "en-US" | The language of the unit names and of what a screen reader hears. |
onComplete | () => void | – | Called once when the count reaches zero. Not called when it mounts at zero or past the target. |
sound | boolean | "tick" | Default true | true plays a chime at zero, "tick" also a tick each second, false stays silent. Only if the visitor has sound on. |
className | string | – | Extra classes for the root. The text size sets the digit size: text-4xl for a large clock. |
Motion and sound
Motion
- Each changing digit rolls in cleanly from above while the previous digit rolls out below over 200 ms, inside a clipped single-digit slot. Only the digits that change move.
- One timer drives the clock, set to wake when the next whole second is crossed, so it does not drift.
- Reduced motion: the digits change in place.
- The demo keeps the clock still until Play is on.
Sound
- A chime when the count reaches zero.
- With sound="tick", a soft tick each second as well. Silent by default.
Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works
Accessibility
- The root has the timer role. Name it with aria-label, as the example does.
- The rolling digits are hidden from screen readers. A polite live region says the time left to the minute, so it changes at most once a minute: 2 days, 14 hours, and 9 minutes left.
- Under a minute it says Less than a minute left, and at zero Time is up.
- Unit names come from the browser's own words for the locale, singular or plural to suit the number.
Source
The source comes with Pro
TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies
Files and dependencies
- Adds
components/ui/countdown.tsx- Packages
- None
- Brings along
- Sound engine
Changelog
- 1.0.0 · 2026-12-03First release.