# Timeline

A record's history grouped by day, with icons, tones and recent events in relative time.

- Family: display
- Import: `import { Timeline } from "@senvenli/react/display";`
- Page: https://design.senvenli.com/docs/components/timeline
- JSON: https://design.senvenli.com/docs/components/timeline.json

## Example: An order's history

Recent events read relative; older ones show their time.

```tsx
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) },
      ]}
    />
  );
}
```

## Examples

### Without times

Titles in the order given; a dot where an item has no icon.

```tsx
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.

### Use something else when

- [stepper](https://design.senvenli.com/docs/components/stepper.md): The steps lie ahead and are a flow to complete.
- [grid-list](https://design.senvenli.com/docs/components/grid-list.md): Events have no time order that matters.

## 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 | Required | Description |
| --- | --- | --- | --- | --- |
| items | `TimelineItem[]` |  | yes |  |
| order | `"newest" \| "oldest"` | `"newest"` | no | With timestamps: `newest` first (default) or `oldest` first. Without them the list keeps the order given. |
| timeZone | `string` |  | no | 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` |  | no | "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` | no | Groups the events under a title per day, for a long activity feed. Off by default. |
| dayHeadingLevel | `4 \| 2 \| 3 \| 5 \| 6` | `3` | no | Heading level of the day titles with `groupByDay`. |

### Tokens it reads

`--ds-background-brand-bold`, `--ds-background-danger`, `--ds-background-neutral`, `--ds-background-success`, `--ds-border`, `--ds-icon`, `--ds-icon-brand`, `--ds-icon-danger`, `--ds-icon-information`, `--ds-icon-subtle`, `--ds-icon-success`, `--ds-icon-warning`, `--ds-radius-full`, `--ds-size-icon`, `--ds-size-icon-large`, `--ds-size-icon-small`, `--ds-space-025`, `--ds-space-050`, `--ds-space-150`, `--ds-space-200`, `--ds-text`, `--ds-text-on-brand`, `--ds-text-subtle`, `--ds-text-subtlest`

## Related

- [grid-list](https://design.senvenli.com/docs/components/grid-list.md)
