Skip to content

Time Ago

Free

When something happened, in words such as 5 minutes ago, or as a running time. The text stays true while the page is open.

  • React Aria
  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Pass the moment. Put a TimeAgoEmpty inside for a document that nobody opened yet.

recent-documents.tsx

TimeAgo

<time>
PropTypeDefaultDescription
dateRequiredDateLike | null—The moment: a Date, an ISO string, epoch milliseconds, or a DateValue (#/lib/date-parse). Past and future both work. null, undefined, and a value that is not a date show the empty text.
kind"elapsed""relative""relative"relative (default): "5 minutes ago". elapsed: the time since date, "1m 25s".
length"long""narrow""short"—The length of the words, the style option of Intl.RelativeTimeFormat and Intl.DurationFormat: long "5 minutes ago", short "5 min. ago", narrow "5m ago". Default: long for relative, narrow for elapsed. The prop is not named style: React and the lint read style as the CSS inline style, which a component does not take.
numeric"always""auto""auto"auto (default): "now", "yesterday", "tomorrow" (by local calendar day), and "last week", "next month", "last year". always: "0 seconds ago", "1 day ago", "1 week ago".
absoluteAfter—From this distance on, show the date in place of the words: "Oct 3", and "Oct 3, 2025" in another year. Milliseconds, or a count and a unit ("45s", "30m", "12h", "7d", "2w"). Default: never.
localestring—The BCP 47 language tag ("en-US", "ar"). Default: the DisplayLocaleProvider, else "en-US".
timeZonestring—The IANA zone of the absolute date and the tooltip date. Default: the reader's zone.
nownumber | Date—A fixed now for tests and stories. With it, the text never updates.
tooltipbooleantrueShow the full date in a Tooltip on hover. Default true.
dateFormatDateTimeFormatOptionsFULL_DATE_FORMATIntl.DateTimeFormat options of the tooltip date. Default { dateStyle: "long", timeStyle: "short" }.
childrenReactNode—A TimeAgoEmpty part: the words of no value. With a value, they are not drawn.
...props<time> attributes—Every other attribute goes to the <time>, with a ref.

TimeAgoEmpty

<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.
  • Use length="short" in table cells.
  • Use absoluteAfter="7d" to show a date after a limit.
  • Use kind="elapsed" for the time since a start.

It renders <time dateTime> with the ISO date.

It is text, with no tab stop. The keyboard and touch do not open its Tooltip.

Text
none · the words change at once, with no fade
Tooltip
popup · the full date opens on hover

Built with

Installs with Time Ago

Components
Full Value
  1. AddedTime Ago, with Full Value.
Open the release