# CoverageStrip (/docs/charts/coverage-strip)

A sensor was meant to report 18 times and reported 10. CoverageStrip fills the measured slots and outlines the missing
ones with a hairline, so you can see where nothing was measured before you trust the numbers. The distinction between
`null` (no measurement) and `0` (a measured zero) is the whole chart, and **shape** carries it, so it survives
forced-colors and print. Nothing is interpolated across a gap.

```tsx
<CoverageStrip
  data={[3, 4, null, 5, 0, null, null, 6, 8, 7, null, 9, 11, 10]}
  expected={18}
  label="percent"
  title="Sensor uptime"
  width={240}
  height={16}
/>
```

## Install

```tsx
import { CoverageStrip } from "@microcharts/react/coverage-strip";

<CoverageStrip data={readings} expected={18} label="percent" title="Sensor uptime" />
```

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

## Try it

```tsx
import { CoverageStrip } from "@microcharts/react/coverage-strip/interactive";

<CoverageStrip
  data={readings}
  expected={18}
  label="percent"
/>
```

## When to use it

Use it for data-quality cells beside a metric, sensor-uptime rows, and trailing-gap detection. For magnitude over time
reach for HeatStrip; for exact values, Sparkline.

## Sizing

**trailing gap counts**

```tsx
// an array that simply stops is the worst gap of all
<CoverageStrip data={[1, 1, 1]} expected={8} label="percent" />
```

**zero ≠ missing**

```tsx
// a measured zero is filled; a gap is hollow
<CoverageStrip data={[3, 0, null, 5]} />
```

## Variants

```tsx
const readings = [3, 4, null, 5, 0, null, 6, 8, 7, null, 9, 11];

<CoverageStrip data={readings} mode="intensity" domain={[0, 12]} />
<CoverageStrip data={readings} shape="round" />
```

```tsx
<CoverageStrip
  data={[3, 4, null, 5, 0, null, null, 6, 8, 7, null, 9, 11, 10]}
  expected={18}
  label="percent"
  locale="de-DE"
/>
```

`mode="intensity"` shades each filled slot by its value; `shape="round"` swaps the slot shape. `locale` formats the
coverage percentage in the gutter and the accessible summary: the strip above reads "56 %" with German percent spacing
instead of "56%". `format` shapes the measured values the interactive entry announces.

## Edge cases

```tsx
// an array that simply stops is the worst gap of all — expected beyond
// data.length pads the tail with hollow "no measurement" slots
<CoverageStrip data={[1, 1, 1]} expected={8} label="percent" />
```

```tsx
<CoverageStrip data={[3, 0, null, 5]} />
```

```tsx
<CoverageStrip data={[]} />
```

An `expected` beyond `data.length` pads the tail with hollow slots, so a feed that stops reporting counts as coverage
loss rather than dropping out of the denominator. A measured `0` is a filled cell like any other value; only `null` (no
record) is hollow. A missing slot stays visibly empty instead of being smoothed into its neighbors, and an empty series
renders the frame alone.

## Four homes

**In a sentence**

```tsx
<p>
  Sensor uptime this week{" "}
  <span className="mc-inline">
    <CoverageStrip data={readings} summary={false} />
  </span>{" "}
  — 86% coverage, two gaps on Tuesday.
</p>
```

**In a table cell**

```tsx
<td>
  <CoverageStrip data={readings} />
</td>
```

**In a KPI card**

```tsx
<div className="kpi">
  <span className="figure">86%</span>
  <span className="unit">sensor uptime</span>
  <CoverageStrip data={readings} />
</div>
```

**In a tab header**

```tsx
<button className="tab">
  North <CoverageStrip data={readings} />
</button>
```

## Accessibility

The accessible name states how many slots were measured, the coverage percentage, and the longest gap: **"10 of 18 slots
measured (56 %); longest gap 4 slots."** An empty series states "No data." instead. The interactive entry roves slots
with ←/→, announcing each one as a measured value or "no measurement".

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, press `Escape`, or
press outside the chart. On touch, a tap pins and a drag scrubs.

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `data` (required) | `(number \| null)[]` | Time-ordered slots; null = no measurement, 0 = a measured zero. |
| `expected` | `number` | Slots the window should contain — lets trailing missingness count. |
| `mode` | `"binary" \| "intensity"` | Presence only (default), or shade measured cells by value. |
| `steps` | `number` | Intensity granularity (default 5). |
| `shape` | `"square" \| "round" \| "dot"` | Cell shape from the shared vocabulary (default 'square'). |
| `label` | `"percent" \| "none"` | State the coverage number in a right gutter. |
| `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).
