SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

Countdown

The days, hours, minutes and seconds left until a launch, a sale's end or an event's doors, as one <time> naming the moment.

Rendered from a fixed now

Ticking from your clock

After the moment

View code
tsx
<Countdown to="2027-04-15T06:30:00Z" now="2027-01-01T09:00:00Z" done="Doors are open" />

<div style="--ui-countdown-value-size: 2.5rem; --ui-countdown-value-color: var(--ui-brand-fg)">
	<Countdown to="2027-04-15T06:30:00Z" done="Doors are open" aria-label="Time left until the doors open" live />
</div>

<Countdown to="2026-04-16T06:30:00Z" done="Doors are open" />

Demo landings

Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.

Every demo, landings and docs sites alike, is listed in the demo gallery.

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { Countdown } from "@sdxc/ui/landing";

The time left from now as a <time datetime> that reads true with no script; live hydrates CountdownLive (map it in the browser entry) to tick on the viewer's clock. Type it with --ui-countdown-value-{font,size,weight,color}, --ui-countdown-label-{font,size} and --ui-countdown-{gap,align}.

Examples

tsx
<Countdown to={launch} done="Live now" labels={{ days: "días" }} live />

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
toDateInputYesThe moment counted down to.
nowDateInputNoThe moment counted from; pass the request's time so server and tests render the same text.
labelsPartial<Labels>NoUnit names, merged over the English ones.
secondsbooleanNoShows the seconds unit and ticks every second; off, the minutes are the smallest unit.
donestringYesWhat the countdown reads once the moment has passed, such as "Doors are open".
livebooleanNoHydrates CountdownLive, which counts from the viewer's clock every second. Needs @sdxc/ui/landing/countdown#CountdownLive in the app's browser entry.
"aria-label"stringNoAccessible name for the <time>.
idstringNoElement id for the <time>.
@sdxc/ui

Can’t find it? Contact us