# EventTimeline (/docs/charts/event-timeline)

EventTimeline answers "what happened when, and for how long?" — uptime windows, on-call shifts, release spans and
incident points on one row. Diamonds mark instants, rects mark durations: the type distinction is a shape, so it
survives 12 px where color coding wouldn't.

```tsx
import { EventTimeline } from "@microcharts/react/event-timeline";

<EventTimeline
  data={[
    { start: Date.UTC(2026, 5, 3, 1), end: Date.UTC(2026, 5, 3, 5), label: "Freeze", kind: "accent" },
    { start: Date.UTC(2026, 5, 3, 6), end: Date.UTC(2026, 5, 3, 15), label: "Healthy", kind: "positive" },
    { start: Date.UTC(2026, 5, 3, 11), label: "Incident", kind: "negative" },
    { start: Date.UTC(2026, 5, 3, 16), end: Date.UTC(2026, 5, 3, 18), kind: "negative" },
    { start: Date.UTC(2026, 5, 3, 20), label: "Release" },
  ]}
  domain={[Date.UTC(2026, 5, 3), Date.UTC(2026, 5, 4)]}
  title="API uptime"
/>
```

## Install

```tsx
import { EventTimeline } from "@microcharts/react/event-timeline";

<EventTimeline data={windows} domain={today} title="API uptime" />
```

Setup (package + stylesheet): [Quickstart](/docs/quickstart#set-up-with-an-ai-agent) or paste [`/agent-setup.md`](/agent-setup.md) into your agent.


## When to use it

- **Good for** — per-service uptime rows, on-call shifts and release windows in cards.
- **Avoid for** — more than ~12 items, or aggregated durations (MiniBar of totals).


## Variants

```tsx
// authored, never implicit — determinism
<EventTimeline data={windows.slice(1, 3)} domain={today} now={Date.UTC(2026, 5, 3, 21)} />
```

```tsx
<EventTimeline
  data={[windows[1], { start: Date.UTC(2026, 5, 3, 16), end: Date.UTC(2026, 5, 3, 18), label: "Deploy", kind: "accent" }]}
  domain={today}
  label="spans"
/>
```

## Edge cases

```tsx
// no item has an end — every mark renders as a diamond, no span fill
<EventTimeline
  data={[
    { start: Date.UTC(2026, 5, 3, 9), label: "Deploy" },
    { start: Date.UTC(2026, 5, 3, 14), label: "Alert", kind: "negative" },
    { start: Date.UTC(2026, 5, 3, 18), label: "Resolved", kind: "positive" },
  ]}
  domain={[Date.UTC(2026, 5, 3), Date.UTC(2026, 5, 4)]}
  title="Today's events"
/>
```

```tsx
// the span starts before the window and ends after it — both edges cut
// flat at the domain boundary, never rescaled to fit
<EventTimeline
  data={[
    { start: Date.UTC(2026, 5, 2, 20), end: Date.UTC(2026, 5, 3, 10), label: "Maintenance" },
  ]}
  domain={[Date.UTC(2026, 5, 3), Date.UTC(2026, 5, 3, 6)]}
  title="Clipped window"
/>
```


## Why this default

Duration is length on a linear time axis — never log or compressed time. Items that overlap the window edge are clipped
flat (honest partial visibility); fully-outside items are excluded with a dev warning. Overlapping spans render
translucent in data order — a legibility device, not an encoding; the exact intervals live in the announcements.

## Accessibility

The accessible name is the coverage read — **"2 spans covering 46% of the window; 0 events."** — where coverage merges
intervals first, so overlaps never double-count. The interactive entry cycles items chronologically: spans announce
**"Freeze: Jun 3, 01:00 to Jun 3, 05:00 — 4h."**, instants **"Incident: Jun 3, 11:00."**

The interactive entry follows the shared [interaction contract](/docs/accessibility#one-interaction-contract):
arrow keys rove between units on both axes, `Home` and `End` jump to the ends, and a click, tap, `Enter` or
`Space` selects a unit — pinning its readout so it survives blur, until you select it again or press `Escape`.
On touch, a tap pins and a drag scrubs.

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `data` (required) | `{ start; end?; label?; kind? }[]` | Spans (with end) and point events (without), ms epoch or Date. |
| `domain` | `[start, end]` | The window — fix it across rows for small multiples. |
| `now` | `number \| Date` | Current-moment tick; authored, never implicit. |
| `label` | `"none" \| "spans"` | Centered in-span labels with deterministic drop-out. |
| `dateFormat` | `Intl.DateTimeFormatOptions \| (d: Date) => string` | (interactive) Announced timestamp format for focused events (defaults to a locale date-time). |
| `animate` | `boolean` | (interactive) Opt-in entrance motion when the chart mounts client-side — add `import "@microcharts/react/motion"` once. Inert on the server, on hydrated server HTML, and under `prefers-reduced-motion`. |

Plus the shared grammar — `data`, `domain`, `color`, `title`, `summary`, `format` — and the layout props (`width`, `height`, `className`, `style`) that every chart accepts. Interactive entries also share `animate` and `live`, and — wherever a chart has more than one navigable unit — `onActive`, `onSelect`, `selectedIndex` and `defaultSelectedIndex`; and — wherever the chart shows a hover value — `readout`. See [the shared grammar](/docs/quickstart#the-shared-grammar).
