# BumpStrip (/docs/charts/bump-strip)

BumpStrip plots one entrant's rank over a run of periods on an inverted ordinal scale, so climbing draws upward. The
band is the range of ranks the series holds: a run between #4 and #7 fills the box, and #1 sits on top when the series
gets there. Ranks are not values: a Sparkline would treat the gap between #2 and #3 as a real distance. End labels ("#5"
→ "#1") anchor the ordinal read without an axis, and change dots mark only the periods where rank moved, so flat runs
stay quiet and the eye lands on the transitions. Set `maxRank` to fix the band at #1 through that rank, which is what
small multiples need to be read against each other.

```tsx
<BumpStrip data={[5, 5, 4, 4, 4, 3, 2, 2, 3, 2, 1, 1]} title="Category rank" width={220} height={26} />
```

## Install

```tsx
import { BumpStrip } from "@microcharts/react/bump-strip";

<BumpStrip data={weeklyRanks} title="Category rank" />
```

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 { BumpStrip } from "@microcharts/react/bump-strip/interactive";

<BumpStrip
  data={weeklyRanks}
/>
```

## When to use it

Use it for leaderboard rows and category-rank trends in KPI cards. For continuous values use Sparkline, and keep it
under about 15 rank levels.

## Sizing

**leaderboard rows**

```tsx
{products.map((p) => (
  <BumpStrip key={p.id} data={p.ranks} maxRank={10} title={p.name} />
))}
```

**gaps for unranked weeks**

```tsx
<BumpStrip data={[2, null, null, 3, 1, 1]} />
```

## Variants

```tsx
// null = unranked that period — the line breaks
<BumpStrip data={[2, null, null, 3, 1, 1]} />
```

```tsx
<BumpStrip data={ranks} maxRank={10} />
```

## Edge cases

```tsx
<BumpStrip data={[3]} maxRank={5} />
```

```tsx
// every period null — no line, no dots; the summary says so plainly
<BumpStrip data={[null, null, null]} />
```

```tsx
// rank never moves — no change dots, a level line
<BumpStrip data={[3, 3, 3, 3, 3]} />
```

A single ranked period draws its two end labels with no visible line, because there is no trajectory yet. An all-`null`
series renders the frame with neither line nor labels, and the accessible name reports that directly. A flat run draws a
level line with zero change dots, because `dots="changes"` marks only the periods where rank moved.

## Four homes

**In a sentence**

```tsx
<p>
  Our blend's Coffee bestseller rank{" "}
  <span className="mc-inline">
    <BumpStrip data={weeklyRanks} width={70} height={16} summary={false} />
  </span>{" "}
  — from #5 to #1 in twelve weeks.
</p>
```

**In a table cell**

```tsx
<td>
  <BumpStrip data={[3, 3, 4, 4, 3, 3, 2, 3, 4, 4, 5, 5]} label="none" dots="none" width={70} height={16} />
</td>
```

**In a KPI card**

```tsx
<div className="kpi">
  <span className="figure">#1</span>
  <span className="unit">up from #5, 12 weeks ago</span>
  <BumpStrip data={weeklyRanks} width={90} height={24} />
</div>
```

**In a tab header**

```tsx
<button className="tab">
  Coffee <BumpStrip data={weeklyRanks} label="none" width={40} height={14} />
</button>
```

## Accessibility

The accessible name is the full trajectory — **"From #8 to #1 over 12 weeks; best #1."** The interactive entry steps the
periods (**"Week 7 of 12: #2."**).

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)[]` | 1-based integer ranks; null = unranked period (gap). |
| `maxRank` | `number` | Fix the band at #1 through this rank, so small multiples share a scale. |
| `dots` | `"changes" \| "none"` | Mark the moments rank actually moved. |
| `label` | `"ends" \| "last" \| "none"` | "#5" → "#1" endpoint labels. |
| `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).
