Dashral Pro is hereSee pricing

Dashral

CountdownNew

Time left until a moment, ticking each second, with unit names in the reader's language.

$ pnpm dlx shadcn@latest add @dashral/countdown

Driftbox 2.0 launches in

Installation

$ pnpm dlx shadcn@latest add @dashral/countdown

Adds the component, the components it builds on, its npm packages and the theme tokens it uses. Or by its full URL: https://dashral.com/r/countdown.json

Usage

example.tsx
import { Countdown } from "@/components/dashral/countdown"

<Countdown to="2026-12-01T09:00:00Z" onComplete={() => router.refresh()} />

Using the npm package? Import from @dashral/ui/components/countdown instead, here and in the examples; the rest is the same.

Examples

Offer ends in

variant="inline" in a pricing card; without days, the hours carry on past 24.

Pro, lifetime−30%
$69$99

Offer ends in

When it's over

onComplete runs once at zero, and completed takes the numbers' place.

API reference

Countdown

Also takes every prop of <div>(opens in a new tab).

PropTypeDefault
toDate | string | number

When it ends. Required.

—
units("days" | "hours" | "minutes" | "seconds")[]

Which to show; the largest takes what's above it (no days: 50 hours).

all four
variant"boxes" | "inline"

Each number in a box with its unit, or one line: "2d 04:15:09".

"boxes"
size"sm" | "default" | "lg"

Its size.

"default"
onComplete() => void

Called once at zero, or right away if to has passed.

—
completedReactNode

Shown in place of the numbers once it's over.

—
classNames{ unit, value, label }

Classes for each part.

—
classNamestring

Extra classes, merged with cn() so yours win.

—

Accessibility

  • role="timer", named by the whole time left ("3 days, 5 hours, 42 minutes, 9 seconds"); a timer isn't announced on every tick.
  • Unit names come from the browser's Intl in the page's locale, plurals included, so they need no translation.
  • The numbers fill in once it's in the browser, so the server never shows a time that's already wrong.

Motion

  • Only the digits that change roll: the old one slides down and fades out as the new one slides in from above, in the same cell (--duration-considered). With reduced motion they change in place.