Skip to content

Countdown

Free

The time left until a date, as short text or as boxes, a line, or large digits. It can pause, and it shows your text when the time runs out.

  • React Aria
  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Set the end date and add one segment for each unit that you show, with a separator between them.

sale-countdown.tsx

Countdown

<span>
PropTypeDefaultDescription
dateRequiredDateLike | 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.
childrenReactNode—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.
maxUnits12342Text only: the number of units, from the biggest that is not 0. Default 2 ("2d 9h", "42m 17s").
trimbooleantrueHide the leading segments at 0 and the separator after each ("42:17" under one hour). Default true.
pausedbooleanfalseStop the shown value and mute the numbers (data-paused). The end does not move.
onEnd—Called once when the time is up, also on mount when date is past.
nowDateLike—A fixed now for tests and stories. With it, no timer runs.
localestring—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>
PropTypeDefaultDescription
variant"box""digits""inline""box"
unitRequired"days""hours""minutes""seconds"—The unit this segment shows. The biggest unit in the root takes the rest (57 hours with no days segment).
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

CountdownSeparator

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

CountdownEmpty

<div>
PropTypeDefaultDescription
data-slotstring—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>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.
  • Use it with no children for short text, such as 2d 9h.
  • Use CountdownSegment parts with the box, inline, or digits variant for a timer.
  • Use CountdownEnded and onEnd to show text or act when the time runs out.
  • Use paused to stop the shown value. The end time does not move.
  • For the time since a past moment, use Time Ago.
  • For a length of time that does not count down, use Duration.
Digits
none · the digits change at once, with no fade

Built with

Installs with Countdown

Components
Rolling Number
  1. AddedCountdown, with Rolling Number.
Open the release