# Key timeline

> API keys, their use and when they expire. Sample data: seven keys from Sep 16 to Nov 14, rotation on Sat 24, prod-runtime at 1.2M calls in 30 days.

- Type 120 · Schedule and status
- Component: `<KeyTimeline>`, the same name as the Figma component
- Install: `npx shadcn add @chartory/key-timeline` (Code and Complete plans)
- Type page: https://usechartory.com/charts/key-timeline

## Installation

1. **Set up the registry once.** Your token in .env and @chartory in components.json. Skip this when another chart is already installed. [Installation guide](https://usechartory.com/docs/installation)

2. **Add the chart.** One command adds the Key timeline component to your project.

```bash
npx shadcn add @chartory/key-timeline
```

3. **Use it.** Pass your rows. The props are the Figma properties.

usage.tsx:

```tsx
import { KeyTimeline }
  from "@/components/chartory/key-timeline"

<KeyTimeline
  data={apiKeys}
  size="m"
  legend
/>
```

## Props

### `<KeyTimeline>`

Every prop but data is a Figma property with the same name and values.

| Prop | Type | Default | Note |
| --- | --- | --- | --- |
| data | KeyTimelineData | Required | The chart's data. The tables below list every field. |
| size | "xs" \| "s" \| "m" \| "l" | "m" | The size class. Each one is laid out again from the data. |
| legend | boolean | true | Shows the legend row under the plot. |
| color | "cat-1" \| "cat-2" \| "cat-3" \| "cat-4" | "cat-1" | The data colour of the primary marks (data/primary). |

### KeyTimelineData

The data prop: one object for the whole chart.

| Prop | Type | Default | Note |
| --- | --- | --- | --- |
| days | number | Required | The number of days. |
| today | number | Required | Where today is on the axis. |
| keys | KeyTimelineLane[] | Required | One entry per key: see KeyTimelineLane. |
| rotate | KeyTimelineRotate | Required | The rotation window: first day, last day and label. |
| xl | [number, string][] | Required | The x axis labels: [position, label] pairs. |

### KeyTimelineLane

One object per entry in keys.

| Prop | Type | Default | Note |
| --- | --- | --- | --- |
| label | string | Required | The name shown on the chart. |
| calls | number[] | Required | The calls per day. |
| total | string | Required | The total as shown. |
| exp? | number | — | Expiry day (0..days) or a later date as text. |
| expText? | string | — | The expiry as shown. |
| tone? | "warn" \| "bad" | — | The tone of the mark (a colour token). |
| silent? | number | — | Silent since this day. |
| newNet? | number | — | The day of the call from a new network. |

### KeyTimelineRotate

The rotate object.

| Prop | Type | Default | Note |
| --- | --- | --- | --- |
| d0 | number | Required | The first day. |
| d1 | number | Required | The last day. |
| text | string | Required | The label as shown. |

## Key timeline: a React and Figma chart in four sizes

### What does a key timeline show?

A key timeline gives each API key a lane with its calls per day, its expiry and planned rotations, and flags keys used from a new network. Use it for key rotation, secrets reviews and access audits.

Chartory ships it as a Figma component and a React component with the same name. The code installs from the shadcn registry with one command and lands in your project as a file you own.

### What is the Key timeline component?

It is one **<KeyTimeline>** component. Its props are the Figma properties with the same names and values, and the props table above lists them. The data is keys with use per day, expiry and events.

Sizes **XS**, **S**, **M** and **L** re-lay the chart out from the data instead of scaling it, so labels stay readable at every size.

### When should I use it?

- **Is it keys over time?** Yes means the key timeline fits.
- **Do expiry dates matter?** Yes means the key timeline fits.
- **Is it keys, not sessions?** Yes means the key timeline fits.

### When does another type fit better?

- **What one key can reach.** Use Reach tree instead.
- **Plain usage.** Use Horizontal bars instead.
- **Signed-in devices.** Use Session lanes instead.

## Key timeline questions

### Does the Key timeline chart work with shadcn/ui?

Yes. It installs through the shadcn registry with the shadcn CLI, and the file lands in your project.

### How do I install it?

Add your token and the @chartory registry once, then run npx shadcn add @chartory/key-timeline. The Installation guide has the steps.

### Can my coding agent install it?

Yes. Connect the Chartory MCP server and ask for the key timeline chart; the agent runs the same command and you review the diff.

### What data does it expect?

Keys with use per day, expiry and events. The sample data comes with the component, and the props table lists every field.

### Which sizes does it ship in?

XS, S, M and L, in Figma and in code. Each size is laid out again from the data, so text and lines keep their size.

### Is it in the Figma file too?

Yes. chart/120-key-timeline has the same properties as the component.

### Does it follow light and dark mode?

Yes. Every paint is a token, so the chart follows light and dark mode and the collection you pick.

### Which plan has the code?

Code and Complete. Figma has the Figma file only.
