import { Timeline } from "@senvenli/react/display";
// A fixed instant with its offset: the same on the build machine and in every browser.
const NOW = new Date("2026-03-18T14:30:00+01:00");
const ago = (minutes: number) => new Date(NOW.getTime() - minutes * 60_000);
export default function Example() {
return (
<Timeline
timeZone="Europe/Berlin"
now={NOW}
items={[
{ id: "4", icon: "circle-check", tone: "success", title: "Order delivered", meta: "Courier", timestamp: ago(3) },
{ id: "3", icon: "truck", tone: "brand", title: "Order shipped", timestamp: ago(240) },
{ id: "2", icon: "pencil", title: "Address changed", meta: "From the mobile app", timestamp: ago(60 * 26) },
{ id: "1", icon: "shopping-cart", title: "Order placed", timestamp: ago(60 * 28) },
]}
/>
);
}import { Timeline } from "@senvenli/react/display";Examples
Without times
Titles in the order given; a dot where an item has no icon.import { Text, Timeline } from "@senvenli/react/display";
export default function Example() {
return (
<Timeline
items={[
{ id: "account", title: "Create your account", tone: "success", icon: "check", children: <Text tone="subtle">Done in under a minute.</Text> },
{ id: "team", title: "Invite your team", tone: "brand" },
{ id: "data", title: "Import your data" },
{ id: "live", title: "Go live" },
]}
/>
);
}Guidelines
When to use it
- What happened to one record, and when.
Accessibility
Built in
- Day headings keep the outline; times show the exact value on hover and to screen readers.
You provide
- The time zone the events belong to.
API reference
Timeline
| Prop | Type | Default | Description |
|---|---|---|---|
itemsRequired | TimelineItem[] | – | |
order | "newest" | "oldest" | "newest" | With timestamps: |
timeZone | string | – | The time zone the events belong to ("Europe/Berlin"): times show in it, and server and browser then format the same text. Left out, the browser's own zone (the server's on the server, settled on the client). An unknown zone falls back to UTC with a warning. |
now | Date | – | "Now" for relative times. Without it, times render absolute on the server and on the first client render, then read relative ("3 min. ago") after mount and stay current while any event is under an hour old. |
groupByDay | boolean | false | Groups the events under a title per day, for a long activity feed. Off by default. |
dayHeadingLevel | 4 | 2 | 3 | 5 | 6 | 3 | Heading level of the day titles with |
itemsRequiredTimelineItem[]order"newest" | "oldest"Default"newest"With timestamps:
newestfirst (default) oroldestfirst. Without them the list keeps the order given.timeZonestringThe time zone the events belong to ("Europe/Berlin"): times show in it, and server and browser then format the same text. Left out, the browser's own zone (the server's on the server, settled on the client). An unknown zone falls back to UTC with a warning.
nowDate"Now" for relative times. Without it, times render absolute on the server and on the first client render, then read relative ("3 min. ago") after mount and stay current while any event is under an hour old.
groupByDaybooleanDefaultfalseGroups the events under a title per day, for a long activity feed. Off by default.
dayHeadingLevel4 | 2 | 3 | 5 | 6Default3Heading level of the day titles with
groupByDay.