# Funnel (/docs/charts/funnel)

Funnel prints one stepped rectangle per stage — 12,400 visitors, 5,704 signups, 2,730 activated, 1,116 paid — each
anchored at zero, so the drop _between_ neighbors is the read: the biggest one is where the pipeline leaks. It never
draws the classic tapered silhouette, which interpolates data that doesn't exist.

```tsx
<Funnel
  data={[
    { label: "Visitors", value: 12400 },
    { label: "Signups", value: 5704 },
    { label: "Activated", value: 2730 },
    { label: "Paid", value: 1116 },
  ]}
  title="Signup funnel"
  width={220}
  height={66}
/>
```

## Install

```tsx
import { Funnel } from "@microcharts/react/funnel";

<Funnel data={stages} title="Signup funnel" />
```

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 { Funnel } from "@microcharts/react/funnel/interactive";

<Funnel
  data={stages}
/>
```

## When to use it

Use it for per-campaign funnels in table cells and conversion bridges in cards. For unordered categories use MiniBar,
and keep a funnel to 6 stages or fewer.

## Sizing

**table cell**

```tsx
<Funnel data={campaign.stages} width={60} height={18} />
```

**the leak**

```tsx
<Funnel data={stages} highlight="Activated" />
```

## Variants

```tsx
// every stage as % of the FIRST stage — cross-funnel comparison
<Funnel
  data={[
    { label: "Visitors", value: 12400 },
    { label: "Signups", value: 5704 },
    { label: "Paid", value: 1116 },
  ]}
  mode="rate"
/>
```

`mode="rate"` always normalizes to stage 1, never to the previous stage: per-stage rates hide compounding loss.

```tsx
<Funnel
  data={[
    { label: "Visitors", value: 12400 },
    { label: "Signups", value: 5704 },
    { label: "Activated", value: 2730 },
    { label: "Paid", value: 1116 },
  ]}
  highlight="Activated"
/>
```

## Edge cases

```tsx
// one stage — a single full-height column, no connector slats, overall 100%
<Funnel data={[{ label: "Visitors", value: 8000 }]} />
```

```tsx
// a stage larger than its predecessor renders truthfully — the summary
// appends "Stage 3 exceeds stage 2."
<Funnel
  data={[
    { label: "Trial", value: 900 },
    { label: "Churned", value: 420 },
    { label: "Win-back", value: 610 },
  ]}
/>
```

A single stage renders as one full-height column with no connector slats, at an overall 100%. A stage larger than its
predecessor renders at its true size, as re-engagement funnels do, and the summary appends the inversion.

## Four homes

**In a sentence**

```tsx
<p>
  This week's signup funnel{" "}
  <span className="mc-inline">
    <Funnel data={stages} width={64} height={20} summary={false} />
  </span>{" "}
  converted 12,400
  visitors to 1,116 paid — a 9% overall rate.
</p>
```

**In a table cell**

```tsx
<td>
  <Funnel data={campaign.stages} width={60} height={18} />
</td>
```

**In a KPI card**

```tsx
<div className="kpi">
  <span className="figure">9%</span>
  <span className="unit">12,400 → 1,116</span>
  <Funnel data={stages} highlight="Activated" width={90} height={28} />
</div>
```

**In a tab header**

```tsx
<button className="tab">
  Organic <Funnel data={stages} width={64} height={16} />
</button>
```

## Accessibility

The accessible name states the span and the overall rate: **"4 stages, 12,400 to 1,116 — overall 9%."** It appends
**"Stage 3 exceeds stage 2."** when a pipeline inverts. The interactive entry roves stages, announcing each as
**"Activated: 2,730 — 22% of Visitors."**

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) | `{ label; value }[]` | Ordered stages. |
| `mode` | `"absolute" \| "rate"` | Rate = % of the FIRST stage (never the previous). |
| `connectors` | `boolean` | Retained-share slats between stages. |
| `label` | `"none" \| "percent" \| "value"` | Above each column (deterministic drop-out; default percent). |
| `highlight` | `number \| string` | Accent the leak stage. |
| `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).
