# Funnel Chart

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

Source: https://www.honestui.com/docs/charts/funnel-chart/static

### Basic Funnel Chart

```tsx
"use client";

import { FunnelChart, type ChartConfig } from "honestui/charts";

// Scenario: Trial signup funnel
const data = [
  { stage: "Visited pricing", people: 12480 },
  { stage: "Started trial", people: 4620 },
  { stage: "Invited a teammate", people: 2310 },
  { stage: "Connected data", people: 1585 },
  { stage: "Upgraded", people: 742 },
];

const chartConfig = {
  people: {
    label: "People",
    colors: {
      light: ["#2563eb"],
      dark: ["#3b82f6"],
    },
  },
} satisfies ChartConfig;

export function ExampleFunnelChart() {
  return (
    <FunnelChart
      data={data}
      config={chartConfig}
      nameKey="stage"
      dataKey="people"
      className="h-full w-full p-4"
    >
      <FunnelChart.Grid />
      <FunnelChart.Axis />
      <FunnelChart.Labels />
      <FunnelChart.Tooltip />
      <FunnelChart.Funnel />
    </FunnelChart>
  );
}

```

## Overview [#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 [#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 [#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 [#installation]

<CommandBlock commands="[&#x22;honestui&#x22;]" />

## Usage [#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.

```tsx
import { FunnelChart, type ChartConfig } from "honestui/charts";
```

```tsx
<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 [#horizontal-layout]

### layout='horizontal'

```tsx
"use client";

import { FunnelChart, type ChartConfig } from "honestui/charts";

// Scenario: Checkout steps, measured step to step
const data = [
  { step: "Viewed cart", sessions: 8920 },
  { step: "Entered email", sessions: 6105 },
  { step: "Added shipping", sessions: 4870 },
  { step: "Added payment", sessions: 3990 },
  { step: "Placed order", sessions: 3412 },
];

const chartConfig = {
  sessions: {
    label: "Sessions",
    colors: {
      light: ["#059669"],
      dark: ["#10b981"],
    },
  },
} satisfies ChartConfig;

export function ExampleFunnelChart() {
  return (
    <FunnelChart
      data={data}
      config={chartConfig}
      nameKey="step"
      dataKey="sessions"
      layout="horizontal"
      calculateFrom="previous"
      className="h-full w-full p-4"
    >
      <FunnelChart.Axis />
      <FunnelChart.Labels />
      <FunnelChart.Tooltip />
      <FunnelChart.Funnel />
    </FunnelChart>
  );
}

```

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 [#tapered-variant]

### variant='tapered'

```tsx
"use client";

import { FunnelChart, type ChartConfig } from "honestui/charts";

// Scenario: Hiring pipeline
const data = [
  { stage: "Applied", candidates: 640 },
  { stage: "Screened", candidates: 212 },
  { stage: "Interviewed", candidates: 84 },
  { stage: "Offered", candidates: 19 },
  { stage: "Hired", candidates: 14 },
];

const chartConfig = {
  candidates: {
    label: "Candidates",
    colors: {
      light: ["#7c3aed"],
      dark: ["#8b5cf6"],
    },
  },
} satisfies ChartConfig;

export function ExampleFunnelChart() {
  return (
    <FunnelChart
      data={data}
      config={chartConfig}
      nameKey="stage"
      dataKey="candidates"
      className="h-full w-full p-4"
    >
      <FunnelChart.Labels />
      <FunnelChart.Tooltip />
      <FunnelChart.Funnel variant="tapered" />
    </FunnelChart>
  );
}

```

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 [#loading-state]

### isLoading='true'

```tsx
"use client";

import { FunnelChart, type ChartConfig } from "honestui/charts";

const chartConfig = {
  people: { label: "People", colors: { light: ["#2563eb"], dark: ["#3b82f6"] } },
} satisfies ChartConfig;

export function ExampleFunnelChart() {
  return (
    <FunnelChart
      data={[]}
      config={chartConfig}
      nameKey="stage"
      dataKey="people"
      isLoading
      className="h-full w-full p-4"
    >
      <FunnelChart.Axis />
      <FunnelChart.Labels />
      <FunnelChart.Funnel />
    </FunnelChart>
  );
}

```

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

## API Reference [#api-reference]

<ApiHeading>
  FunnelChart
</ApiHeading>


  ### `data`

type: `TData[]`

One row per stage, in funnel order.

  ### `config`

type: `ChartConfig`

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

  ### `nameKey`

type: `keyof TData & string`

The field holding each stage's name.

  ### `dataKey`

type: `keyof TData & string`

The numeric field counted at each stage.

  ### `layout`

type: `&#x22;vertical&#x22; | &#x22;horizontal&#x22;` · default: `&#x22;vertical&#x22;`

Draws stages as columns or as rows.

  ### `calculateFrom`

type: `&#x22;first&#x22; | &#x22;previous&#x22;` · default: `&#x22;first&#x22;`

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

  ### `className`

type: `string`

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

  ### `animation`

type: `boolean` · default: `true`

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

  ### `isLoading`

type: `boolean` · default: `false`

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

  ### `ariaLabel`

type: `string`

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

  ### `onStageClick`



) => void">
    Fires when a stage is selected and `Funnel` has `isClickable`. The stage carries its value, conversion rates, and drop-off.

  ### `chartOptions`



">
    Escape hatch merged over the generated ECharts option object.


<ApiHeading>
  Funnel
</ApiHeading>


  ### `variant`

type: `&#x22;stepped&#x22; | &#x22;tapered&#x22;` · default: `&#x22;stepped&#x22;`

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

  ### `radius`

type: `number` · default: `2`

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

  ### `showDropOff`

type: `boolean` · default: `true`

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

  ### `dropOffLabels`

type: `boolean` · default: `true`

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

  ### `isClickable`

type: `boolean` · default: `false`

Enables the pointer cursor and `onStageClick`.


<ApiHeading>
  Labels
</ApiHeading>


  ### `valueFormatter`



string">
    Formats the count shown under each conversion rate.

  ### `percentFormatter`



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

  ### `hideValue`

type: `boolean` · default: `false`

Shows only the conversion rate.


<ApiHeading>
  Axis
</ApiHeading>


  ### `tickFormatter`



string">
    Formats stage names without changing the underlying data.

  ### `hide`

type: `boolean` · default: `false`

Hides the stage names while keeping the layout.


<ApiHeading>
  Tooltip
</ApiHeading>


  ### `variant`

type: `&#x22;default&#x22; | &#x22;frosted-glass&#x22;` · default: `&#x22;default&#x22;`

Tooltip surface treatment.

  ### `roundness`

type: `&#x22;sm&#x22; | &#x22;md&#x22; | &#x22;lg&#x22; | &#x22;xl&#x22;` · default: `&#x22;lg&#x22;`

Tooltip corner radius.

  ### `position`

type: `&#x22;fixed&#x22; | &#x22;variable&#x22;` · default: `&#x22;variable&#x22;`

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

  ### `valueFormatter`



string">
    Formats counts and drop-off in the tooltip.

  ### `defaultIndex`

type: `number`

Opens the tooltip on a specific stage after mount.
