Skip to documentation content

Funnel Chart

A composable funnel chart for showing how many people or items move through an ordered sequence of stages.

Basic Funnel Chart

Overview

Use a funnel chart when the question is where people drop out of an ordered process: a signup flow, a checkout, a sales pipeline, or a hiring loop. Each stage is counted once, and every stage after the first is a subset of the one before it.

The default stepped variant draws each stage as a bar on a shared scale, with the volume lost since the previous stage shown as a lighter ghost above it. Bars on one baseline are easier to compare than the slanted edges of a classic funnel, and the conversion rate for every stage sits above its bar. The tapered variant draws the familiar narrowing shape for presentations where the silhouette matters more than precise comparison.

Anatomy

FunnelChart owns the stage data, colors, layout, and loading state. Stages render in data order. Add Funnel for the bars, Labels for the conversion rate and count above each stage, Axis for the stage names, Grid for dashed value guides, and Tooltip for the full breakdown of a stage: its count, its share of the first and previous stage, and how many dropped off.

Accessibility

A descriptive accessible name listing every stage, its count, and its conversion rate is generated when ariaLabel is omitted. The conversion labels are drawn in the foreground color and the drop-off ghost is a tint of the stage color, so the chart does not rely on hue alone. The tooltip is pointer-operated, so place any number people must act on in the labels or in nearby text.

Installation

npm install honestui

Usage

The data is an ordered array with one row per stage. nameKey names the stage and dataKey selects the count and its chart config entry.

import { FunnelChart, type ChartConfig } from "honestui/charts";
<FunnelChart data={data} config={chartConfig} nameKey="stage" dataKey="people">
  <FunnelChart.Grid />
  <FunnelChart.Axis />
  <FunnelChart.Labels />
  <FunnelChart.Tooltip />
  <FunnelChart.Funnel />
</FunnelChart>

A stage that has its own entry in config, keyed by its name, takes that color instead of the series color. Use this sparingly, for example to mark the outcome stage.

Horizontal Layout

layout='horizontal'

Horizontal bars leave room for long stage names. This example sets calculateFrom="previous", so each label shows the step-to-step rate instead of the share of the first stage, which makes the weakest step easy to spot.

Tapered Variant

variant='tapered'

The tapered variant uses the classic funnel shape. Later stages fade so the shape reads as one narrowing flow. Its width encodes each count on the same scale as the first stage, but comparing slanted widths is harder than comparing bars, so prefer stepped when people need to compare stages closely.

Loading State

isLoading='true'

Pass isLoading to reserve the chart layout with neutral, descending bars and the same loading treatment as the other Honest UI charts.

API Reference

FunnelChart
PropTypeDefaultDescription
data*TData[]–

One row per stage, in funnel order.

config*ChartConfig–

Defines the label and theme colors for dataKey, and optionally for individual stage names.

nameKey*keyof TData & string–

The field holding each stage's name.

dataKey*keyof TData & string–

The numeric field counted at each stage.

layoutvertical|horizontal"vertical"

Draws stages as columns or as rows.

calculateFromfirst|previous"first"

Measures each label's conversion rate against the first stage or the stage before it.

classNamestring–

Additional CSS classes for the chart container. Give the chart an explicit height.

animationbooleantrue

Enables the intro animation. Reduced-motion preferences disable it automatically.

isLoadingbooleanfalse

Replaces the data with neutral placeholder bars and a progress label.

ariaLabelstring–

Accessible name for the canvas chart. A label listing every stage is generated when omitted.

onStageClick(stage: FunnelStage<TData>) => void–

Fires when a stage is selected and Funnel has isClickable. The stage carries its value, conversion rates, and drop-off.

chartOptionsRecord<string, unknown>–

Escape hatch merged over the generated ECharts option object.

Funnel
PropTypeDefaultDescription
variantstepped|tapered"stepped"

Bars on a shared baseline, or the classic narrowing funnel shape.

radiusnumber2

Bar corner radius in pixels. Applies to the stepped variant.

showDropOffbooleantrue

Draws the volume lost since the previous stage as a tinted ghost bar.

dropOffLabelsbooleantrue

Labels each ghost with its drop-off percentage when the ghost is tall enough to hold it.

isClickablebooleanfalse

Enables the pointer cursor and onStageClick.

Labels
PropTypeDefaultDescription
valueFormatter(value: number) => string–

Formats the count shown under each conversion rate.

percentFormatter(share: number) => string–

Formats the conversion rate, given a share from 0 to 1.

hideValuebooleanfalse

Shows only the conversion rate.

Axis
PropTypeDefaultDescription
tickFormatter(value: string, index: number) => string–

Formats stage names without changing the underlying data.

hidebooleanfalse

Hides the stage names while keeping the layout.

Tooltip
PropTypeDefaultDescription
variantdefault|frosted-glass"default"

Tooltip surface treatment.

roundnesssm|md|lg|xl"lg"

Tooltip corner radius.

positionfixed|variable"variable"

Pins the tooltip to the top or lets it follow the pointer.

valueFormatter(value: number) => string–

Formats counts and drop-off in the tooltip.

defaultIndexnumber–

Opens the tooltip on a specific stage after mount.