# TapeGauge (/docs/charts/tape-gauge)

TapeGauge answers "what is it now, is that OK, and where is it heading?" for a single live reading — airspeed,
throughput, temperature, queue depth. The scale scrolls past a fixed center pointer, so the value stays parked where
your eye already is; semantic zones mark the safe, caution, and danger bands; and a stack of chevrons encodes the rate
of change as a channel entirely separate from the level. It is the aviation primary-flight-display tape, shrunk to a
word.

```tsx
<TapeGauge
  value={142}
  rate={1}
  zones={[
    { from: 100, to: 130, tone: "pos" },
    { from: 130, to: 150, tone: "warn" },
    { from: 150, to: 200, tone: "neg" },
  ]}
  span={60}
  title="Airspeed"
  width={46}
  height={72}
/>
```

## Install

```tsx
import { TapeGauge } from "@microcharts/react/tape-gauge";

<TapeGauge value={142} rate={1} zones={zones} span={60} title="Airspeed" />
```

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** — a live changing reading with a safe/caution band; value plus trend at a glance.
- **Avoid for** — a history you want to scan (Sparkline) or a single static number (Delta).


## Variants

```tsx
<TapeGauge value={142} rate={-1} zones={zones} span={60} orientation="horizontal" />
// label="none" drops the in-chart readout for an external number
<TapeGauge value={142} rate={1} zones={zones} span={60} label="none" />
```

```tsx
<TapeGauge
  value={14200}
  format={{ maximumFractionDigits: 0 }}
  locale="de-DE"
/>
```

`format` also takes `Intl.NumberFormatOptions` — with a `locale`, both the in-gauge readout and the accessible summary
follow that locale's own grouping ("14.200" in German, not "14,200").

## Edge cases

```tsx
// a non-finite value renders an empty gauge — no pointer, no readout
<TapeGauge value={NaN} title="Sensor offline" />
```

```tsx
// zones are optional — the gauge still tracks level and rate without bands
<TapeGauge value={142} rate={1} span={40} />
```


## Why this default

The value is pinned at the pointer and the scale moves instead, because on a live instrument the one thing you never
want to hunt for is the current reading. Rate lives on its own channel — chevrons, not position — so a fast climb and a
high value are never confused for one another, the failure mode that sinks a naïve gauge. The visible span is fixed
while the value updates, so a jump reads as motion of the scale rather than a silent rescale that hides how far it
moved.

## Accessibility

The accessible name states the level, the trend word, and the containing zone — **"Now 142, rising; in the 130–150
zone."** The interactive entry re-announces the reading through a polite live region, throttled so a rapidly changing
value never floods a screen reader, and focus reads the full summary on demand.

This chart is a single unit, so there is nothing to rove between: a click, tap, `Enter` or `Space` selects it
and fires `onSelect`, and no selection stays pinned. That is the scalar half of the shared
[interaction contract](/docs/accessibility#one-interaction-contract).

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `value` (required) | `number` | The current level; parked at the pointer. |
| `rate` | `number` | Signed units/tick; drives the chevrons. |
| `zones` | `{ from, to, tone }[]` | Semantic bands on the scale. |
| `span` | `number` | Visible scale extent; fixed while live. |
| `rateTiers` | `[number, number]` | Thresholds for 1 and 2 chevrons (default [span/60, span/15]). |
| `orientation` | `"vertical" \| "horizontal"` | Tape direction (default vertical). |
| `announceEvery` | `number` | (interactive) Minimum ms between live-region announcements as the value streams (default 5000). |
| `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).
