Skip to content
Thrum

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/countdown

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Props

PropTypeDefaultDescription
targetDate–The moment the count reaches zero.
durationnumber–Seconds to count down from the moment it mounts, when there is no target.
nowDate–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.
pausedbooleanDefault falseStop 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.
daysboolean–Show a days unit. By default it shows while a day or more is left; without it the hours count past 24.
localestringDefault "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.
soundboolean | "tick"Default truetrue plays a chime at zero, "tick" also a tick each second, false stays silent. Only if the visitor has sound on.
classNamestring–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

SourcePro

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. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor