How it works
Hand-written SVG laid out in real pixels. Each step is a rounded block; behind it a hatched block reaches up to the height of the step before, so the drop-off reads as a shape rather than a number. Blocks slide up out of a clip at the baseline (translateY, so the rounded tops keep their shape). Chips are HTML placed above each block and count with JavaScript; the selection only changes colour. New data moves every block from its old height through CSS geometry transitions.
Use it for
- A short ordered flow where people drop off: visit, view, cart, pay; sign up, verify, first project.
- A dashboard tile that answers "how many made it to the end" and "where did we lose them".
- Comparing the same funnel between two periods by switching data.
Look elsewhere when
- Steps that are not a strict sequence, or people who can skip steps: use bars.
- More than five or six steps: blocks get too narrow for their chips; use a table or a full funnel report.
- Change of one step over time: use a line chart.
Usage
import { FunnelChart } from './FunnelChart.jsx'
export function StoreFunnel() {
return (
<FunnelChart
title="Store funnel"
subtitle="This week"
onOpen={() => {}}
stages={[
{ name: 'Visits', value: 12480 },
{ name: 'Product', value: 7215 },
{ name: 'Cart', value: 2306 },
{ name: 'Paid', value: 864 },
]}
color={8}
/>
)
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
stages | { name: string, value: number, color?: number | string }[] | — | Steps from first to last. Three to five fit a card. color overrides the card colour for one step. |
title / subtitle / icon | ReactNode | — | Card header: a tinted icon tile, a 15px title and a quieter subtitle after it. |
onOpen / action | () => void / ReactNode | — | onOpen adds a chevron button at the end of the header. action replaces it with any node. |
value / unit | number | string / string | — | Hero. By default it is the conversion from the first step to the selected one, formatted with formatPercent; a number you pass is formatted with formatValue. |
caption | string | (first: string, step: string, index: number) => string | — | Line above the hero. By default "Visits to Paid", following the selection. |
delta | { value: number, label?: string, positive?: 'up' | 'down', format?: (n) => string } | — | Change badge after the hero, such as the change against last week. |
selected / onSelect | number / (index: number) => void | — | The step at rest, drawn solid. Defaults to the last one; a click or Enter pins another. |
color | number | string | 1 | Block colour: 1–8 for --ds-chart-N (soft at rest, solid when selected), or a CSS colour. |
height | number | 128 | Plot height in px. Each step keeps at least 18px so a tiny last step stays visible. |
showRate | boolean | true | Conversion chips above each step after the first. The chip into the selected step is ink. |
formatValue / formatPercent | (n: number) => string | (n) => n.toLocaleString('en-US') / 12% or 4.5% | Formats for step values and for percentages (chips, hero, screen-reader text). |
label | string | — | Accessible name of the funnel and caption of the hidden table. Defaults to the title. |
labels | object | — | Replaces built-in text: open, chart(name, count), caption(first, step), step(name, value, ofFirst, fromPrevious), dataTitle, stage, value, conversion, share. |
replayKey | string | number | — | Change it to play the entrance again. Renaming steps also replays it; changing only values glides. |
className / style / ...rest | HTMLAttributes | — | Passed to the card root, which fills its container width. |
Accessibility
- The funnel is a focusable group named after the chart. Left and Right move between steps, Home and End jump to the ends, Enter pins a step and Escape goes back to it.
- Each move is announced through a polite live region with the value, share of the first step and conversion from the previous one.
- A visually hidden table lists every step; the drawing is hidden from screen readers.
- Step names and values are real text under the blocks; the selected chip differs by fill and text colour, not hue alone.
- Reduced motion shows the final funnel at once and the numbers do not count.
Motion
Entrance waits until 30% of the card is visible. Blocks slide up over 900ms on cubic-bezier(0.22, 1, 0.36, 1), 70ms apart; hatched drop-offs fade in from 320ms; chips pop on a spring from 380ms, 90ms apart, and count up with the hero; names rise from 160ms. Moving the selection recolours in 160ms and counts in 380ms; new data glides over 900ms.
Add it to your project
Pro members copy a prompt and their coding agent installs the source, the same way as the free components.
FunnelChart.jsxfunnel-chart.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.



