Countdown
betaA countdown to a date whose days, hours, minutes and seconds roll digit by digit, compact or as labelled tiles.
- Display
- 1 file
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add countdownnpm packages installed: class-variance-authority.
import { Countdown } from "@/components/ui/countdown";Default
Labelled
Completing
Fixed Units
Localised
Injected Clock
<Countdown>
| Prop | Type | Default |
|---|---|---|
date (required)The moment to count down to. A string is parsed with Date.parse. | Date | number | string | — |
format | "compact" | "labelled" | "compact" |
labelsCaptions and screen-reader sentences, for translation. | CountdownLabels | — |
liveAnnounce the remaining time politely as it changes — at most once a minute. Off by default. | boolean | false |
localesLocale for unit names and digits. Defaults to the user's. | Intl.LocalesArgument | — |
nowThe current time. Set it to drive the countdown yourself, to render a definite value on the server, or in tests; while it is set the component does not tick on its own. | Date | number | — |
onCompleteCalled once when the countdown reaches zero — including when | () => void | — |
unitsWhich units to show, largest first. | "auto" | readonly CountdownUnit[] | "auto" |
Plus every attribute of <div> except children.
7/7
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — does not apply
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — does not apply
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes