Xzero UI
Pro library

Countdown

A launch countdown with rolling digits that morphs into a live state at zero.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/countdown
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/countdown

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Countdown } from "@/components/xzero/countdown/countdown";

export function LaunchCountdown() {
  return (
    <Countdown
      target="2026-10-06T10:00:00"
      timeZone="America/Los_Angeles"
      label="Keynote starts in"
      onComplete={() => router.refresh()}
    />
  );
}

Examples

Compact hours and minutes

<Countdown variant="compact" units={["hours", "minutes"]} target={saleEndsAt} completeLabel="Ended" />

API reference

Countdown

A countdown to a fixed moment with rolling digit wheels, in a large display form or a compact pill.

PropTypeDefaultDescription
target (required)Date | number | string–The moment to count to. Numbers are epoch ms; ISO strings with Z or an offset are exact; strings without an offset are wall time in timeZone, or UTC.
timeZonestring–IANA zone for a target string without an offset, such as "America/Los_Angeles". Daylight saving is resolved for the target date.
unitsCountdownUnit[]["days", "hours", "minutes", "seconds"]Units to show, sorted largest first. The largest unit absorbs the rest, so hours can pass 24 when days are left out.
variant"large" | "compact""large"Large digits with unit labels, or one compact line for banners and table cells.
completeLabelReactNode"Live now"Shown once the target passes, with a pulsing live dot. The digits morph into it.
onComplete() => void–Fires once when the countdown reaches zero while mounted, on time even in a hidden tab.
labelstring"Time remaining"Accessible name, such as "Keynote starts in".
clock() => numberDate.nowClock source in epoch ms. Pass a server-synced clock when device time cannot be trusted.
refRef<HTMLDivElement>–The root element.
classNamestring–Class on the root.

toEpoch

Resolves a countdown target to epoch ms without reading the device time zone. Returns NaN for an unparseable string.

PropTypeDefaultDescription
target (required)Date | number | string–Same forms as the target prop.
timeZonestring–IANA zone for strings without an offset.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in progress

Guidance for AI tools

Countdown: A launch countdown with rolling digits that morphs into a live state at zero. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components