# Funnel Chart (/ui/components/react/funnel-chart)

A funnel chart shows how much of a volume survives each step of a process. Like every chart here it is a recipe: [Recharts](https://recharts.github.io) draws it and the [chart layer](/ui/components/react/charts) themes it. Each example below is a complete file to paste and adapt.

## Installation [#installation]

Recharts is the only extra dependency, with `react-is` at the same version as `react`:

```bash
pnpm add recharts react-is   # or: npm install recharts react-is / yarn add recharts react-is / bun add recharts react-is
```

The examples import the chart layer from `@/components/chart`. If your project doesn't have it yet, copy it from the [Charts](/ui/components/react/charts#the-chart-layer) page first.

## Example [#example]

Every step is the same color, because the steps are 1 measure, and a stroke in the surface color separates them. The rows go largest first. `width="70%"` on the `Funnel` leaves room beside it for the step names, and `lastShapeType="rectangle"` ends it on a bar instead of a point.

```tsx
'use client'

import { Funnel, FunnelChart, LabelList, Tooltip } from 'recharts'
import { Chart, ChartTooltip, chartColors, useChartMotion } from '@/components/chart'

const data = [
  { step: 'Store visits', visitors: 48200, fill: chartColors[0] },
  { step: 'Product views', visitors: 31600, fill: chartColors[0] },
  { step: 'Added to cart', visitors: 12400, fill: chartColors[0] },
  { step: 'Checkouts', visitors: 6900, fill: chartColors[0] },
  { step: 'Orders', visitors: 4100, fill: chartColors[0] },
]

const count = new Intl.NumberFormat('en-US')

export default function FunnelChartDefault() {
  const motion = useChartMotion()

  return (
    <div className="w-full max-w-2xl">
      <Chart className="h-72">
        <FunnelChart responsive aria-label="Store visitors from first visit to order">
          <Tooltip content={<ChartTooltip formatValue={(value) => count.format(value)} />} />
          <Funnel
            data={data}
            dataKey="visitors"
            nameKey="step"
            width="70%"
            stroke="var(--background)"
            lastShapeType="rectangle"
            {...motion.series}
          >
            <LabelList dataKey="step" position="right" fill="var(--foreground)" stroke="none" />
          </Funnel>
        </FunnelChart>
      </Chart>
    </div>
  )
}
```

## Accessibility [#accessibility]

- Pass `aria-label` to the chart with what it shows (`"Store visitors from first visit to order"`). It becomes the accessible name of the SVG.
- The chart takes focus, which opens the tooltip on the first step. Recharts doesn't move it between the steps of a funnel with the arrow keys, so keep the step names as labels in the chart, and put the numbers in a table when readers need them.
- Nothing depends on color: every step is named beside its shape.
- Nothing animates under reduced motion.
