Countdown

Feedback

A ticking timer with clock and circular variants.

The Countdown counts down from a given number of seconds. Control it with running and onRunningChange, or imperatively through the CountdownHandle exposed via ref.

npx shadcn@latest add countdown

Interactive

Start, pause, and reset the timer with the controls below.

Preview
Live
01:30
tsx
1const [running, setRunning] = useState(false)
2
3<Countdown
4 seconds={90}
5 running={running}
6 onRunningChange={setRunning}
7 onComplete={reset}
8/>

Variants

Switch between the clock and circular displays.

Preview
Live
01:30
tsx
1<Countdown seconds={300} variant="clock" autoStart />
2<Countdown seconds={60} variant="circular" />

API reference

All props of the underlying Base UI primitive are forwarded. The table below documents the Shelf-specific props.

PropTypeDescription
secondsnumberTotal duration to count down from.
variant"clock" | "circular"= "clock"Visual display of the timer.
autoStartboolean= falseStart counting on mount.
onComplete() => voidCalled once the countdown reaches zero.
runningbooleanControlled running state.
onRunningChange(running) => voidCalled when the timer starts or stops.
refCountdownHandleImperative handle with start, pause, and reset.