Set the end date and add one segment for each unit that you show, with a separator between them.
sale-countdown.tsx
Countdown
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| date | DateLike | null | — | The end: a Date, an ISO string, epoch milliseconds, or a DateValue (#/lib/date-parse). null, undefined, and a value that is not a date show the empty text. |
| children | ReactNode | — | CountdownSegment and CountdownSeparator parts, CountdownEnded (what shows at 0), and CountdownEmpty, the words of no date. With no segments, the root renders the text ("2d 9h"). |
| length | "long""narrow""short" | "narrow" | Text only: the style of Intl.DurationFormat. narrow (default) "2d 9h", short "2 days, 9 hr", long "2 days, 9 hours". Not named style: a component does not take the CSS inline style. |
| max | 1234 | 2 | Text only: the number of units, from the biggest that is not 0. Default 2 ("2d 9h", "42m 17s"). |
| trim | boolean | true | Hide the leading segments at 0 and the separator after each ("42:17" under one hour). Default true. |
| paused | boolean | false | Stop the shown value and mute the numbers (data-paused). The end does not move. |
| on | — | Called once when the time is up, also on mount when date is past. | |
| now | DateLike | — | A fixed now for tests and stories. With it, no timer runs. |
| locale | string | — | The BCP 47 language tag: words, digits, and dir. Default: the DisplayLocaleProvider locale, else "en-US" (useDisplayLocale), never the browser language. |
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
CountdownSegment
<span>CountdownSeparator
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
CountdownEmpty
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| data-slot | string | — | The data-slot of the root: the item's own slot ("time-ago"). Default "empty-value". |
From Base UIUseRenderBase UI docs | |||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
CountdownEnded
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
Built with
Installs with Countdown
- Components
- Rolling Number





