Countdown

A live days/hours/minutes/seconds display.

Real use · launch countdown (90s demo)

0days
00hours
01minutes
29seconds

Selected units, plain style

01minutes
29seconds

Using Countdown

Silica ships one design system through three paths. They share a class vocabulary but are not interchangeable — pick the one that matches what you are building.

Plain HTML — CSS classes

The Tailwind v4 plugin. Works in any framework or none — Rails, Django, PHP, Go, a static file. This path ships no JavaScript, so Countdown is styled but inert: its behavior comes from countdown. For that behavior with no framework, use the node-tree path below.

/* in your CSS */
@import "tailwindcss";
@plugin "@wizeworks/silicaui";

Root class countdown, with 4 modifiers:

  • .countdown
  • .countdown-label
  • .countdown-plain
  • .countdown-unit
  • .countdown-value

React

Typed components over those same classes, with behavior and accessibility from Base UI.

npm i @wizeworks/silicaui-react
import { Countdown } from "@wizeworks/silicaui-react";

Props

PropTypeRequiredDescription
toDate | numberyesTarget time (a Date or epoch-ms timestamp).
unitsCountdownUnit[]noWhich units to show. Default all four.
plainbooleannoDrop the boxes for an inline number run.
onComplete() => voidnoCalled once when the countdown reaches zero.

Source of the demo above

The exact file that renders the examples above, so it can never drift from them. It imports a few of this site’s own layout helpers (../lib/…), so read it for the component calls rather than copying it whole.

Show source
import { useState } from "react";
import { Countdown } from "@wizeworks/silicaui-react";
import { Section } from "../lib/Section";

export function CountdownDemo() {
    const [target] = useState(() => Date.now() + 90 * 1000);

    return (
        <>
            <Section title="Real use · launch countdown (90s demo)">
                <Countdown to={target} />
            </Section>

            <Section title="Selected units, plain style">
                <Countdown to={target} units={["minutes", "seconds"]} plain />
            </Section>
        </>
    );
}

Vanilla — node tree to HTML

Countdown — a live clock. Renders the CORRECT values for its build moment rather than zeros, so a page that never hydrates shows a sensible (if frozen) countdown instead of empty boxes; the handler then takes over. Build a node tree, project it with toHtml(), and let the zero-dependency runtime hydrate it. This is the path for generated or user-authored documents — a site builder, CMS output, a static export.

npm i @wizeworks/silicaui-html @wizeworks/silicaui-behaviors
import { atom, toHtml } from "@wizeworks/silicaui-html";

const node = atom("Countdown", "countdown", { /* props */ });
const markup = toHtml(node);

Styling on this path is the class string in the second argument — the same classes as the Plain HTML section above. There is no color prop here; write "countdown countdown-primary" rather than passing a colour as a prop.

Takes children
no
Hydrated by
countdown

Load @wizeworks/silicaui-behaviors on the page or this markup renders correctly and does nothing.

The full API for Countdown, on every path, is available through the Silica MCP server.