Skip to content
Thrum

Funnel chart

The stages of a conversion, from first visit to purchase, as bars that shrink with each step. Every stage shows its count and its share of the first stage, and the drop from the stage before is written between the bars. For counts that do not flow from one step to the next, use the bar chart.

Install

npx shadcn@latest add @thrum-pro/funnel-chart

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Data shape

Type
type FunnelChartStage = {
  name: string;
  value: number | null; // null = no data
};
Sample
[
  { name: "Visited", value: 48200 },
  { name: "Signed up", value: 9640 },
  { name: "Started trial", value: 4120 },
  { name: "Subscribed", value: 1310 },
]

Props

PropTypeDefaultDescription
datareadonly FunnelChartStage[]RequiredThe stages in order, first to last. Bars are sized against the largest stage, which is usually the first. Negative counts are drawn as zero.
labelstringRequiredWhat is counted. Read by screen readers and used as the table caption.
align"center" | "start"Default "center"Bars centred on one line, the classic funnel shape, or lined up at the bottom (columns) or the left (rows) so their lengths compare exactly.
colorstringDefault var(--chart-1)Any CSS colour for the bars and the bands that join them.
formatIntl.NumberFormatOptionsDefault compactHow counts are written. Shares of the first stage and drops are whole percentages.
localestringDefault "en-US"Locale for numbers. Fixed by default so the server and the browser print the same text.
onActiveChange(index: number | null) => void–Called with the index of the stage under the cursor, or null when the cursor leaves.
soundbooleanDefault truePlay a tick as the cursor moves between stages, if the visitor has sound on.
emptyLabelstringDefault "No data"Text shown when there are no stages.
classNamestring–Sets the size. The default is full width and 288 pixels tall. At 480 pixels wide and more the stages are columns, left to right; below that they are rows, top to bottom.

Motion and sound

Motion

  • First draw: each bar grows out from its middle (or its start) in 250 ms, stages 40 ms apart, and the joining bands fade in after them.
  • New data with the same number of stages: bars and bands move to their new sizes in 400 ms with no overshoot. A different number of stages, or a switch between columns and rows, draws again at once.
  • The band behind the active stage follows the pointer on a stiff spring.
  • Reduced motion: the chart appears complete, and changes and the cursor move instantly.

Sound

  • A soft tick each time the cursor lands on a different stage, at most one every 40 ms.

Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works

Accessibility

  • The chart is one tab stop. It is exposed as a slider whose value text is the stage under the cursor, for example “Started trial: 4,120, 9% of Visited, 57% drop from Signed up”.
  • A visually hidden table carries every stage with its count, its share of the first stage and its change from the stage before.
  • Every number is also written on the chart, so nothing depends on colour or on reading a bar's length. A drop is written with a minus sign; a stage larger than the one before gets a plus sign.
  • Each stage's whole slot, text included, is the pointer target.
KeysAction
TabFocus the chart. The cursor goes to the last stage.
→ ↓Move the cursor to the next stage.
← ↑Move the cursor to the stage before.
Home / EndJump to the first or last stage.
EscHide the cursor.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/funnel-chart.tsx
Packages
motion
Brings along
Chart foundationsMotion tokensSound engineChart tooltip

Changelog

  1. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor