Countdown
Ticking day/hour/minute/second tiles counting down to a target.
Import
import { Countdown } from "@cronus-ui/ui";
npx cronus-ui add countdown
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component CountdownDefault layout:inline style:countdown {
aria-label:"Launch"
label "Launch"
}
page "/audit/countdown/default" type:custom {
use CountdownDefault
}
API Reference
Generated from the component's exported types.
CountdownLabels
| Prop | Type | Default | Description |
|---|---|---|---|
days* | string | — | — |
hours* | string | — | — |
minutes* | string | — | — |
seconds* | string | — | — |
CountdownProps
Extends Omit<HTMLAttributes<HTMLDivElement>, "children">
| Prop | Type | Default | Description |
|---|---|---|---|
target* | Date | string | number | — | The moment the countdown reaches zero: a `Date`, an ISO-8601 string, or an epoch-ms number. An unparsable target keeps the `--` placeholder and never ticks or completes. |
onComplete | () => void | — | Fired exactly once when the countdown reaches zero (immediately after mount when the target is already in the past). Re-arms if `target` later changes to a new future moment. |
compact | boolean | false | Smaller tiles + type for tight spots (toolbars, banners, table cells). |
labels | Partial<CountdownLabels> | — | Override any subset of the unit captions, e.g. `{ days: "dias" }`. |
className | string | — | Additional class names merged onto the root. |
id | string | — | DOM id of the root element. |