Skip to content
EspañolEnglish
All components (283)

Funnel

Data · FunnelChart · .amset-funnel

What it is and when to use it

The stages of a process and how many people remain in each: visits, cart, payment, purchase. Each stage says what share of the previous one got there, which is what you look at in a funnel: where people drop off.

When to use it

  • Processes with ordered stages, from more to less.
  • stages are the stages: { key, label, value }.

When not to

  • Parts of a total without order: DonutChart.
  • Evolution over time: LineChart.

Keyboard: Tab takes you to the drawing and the arrows move from stage to stage, with a spoken notice.

Accessibility: it is an image (role="img") with a written summary ("From 12,000 in Visits to 480 in Purchase: 4% get there"), and underneath goes a real table. The numbers go outside the bar: they read the same even if it is tiny.

Fine-tuning: --amset-funnel-bar is the colour and --amset-funnel-height the height of each bar.

What it looks like

From catalogue to purchase

Last 30 days

Conversion

4 %

480 purchases from 12,000 visits

Use the arrow keys to move through the values, Home and End to jump to the first and last, and Escape to leave.
From catalogue to purchase
StageValueof the previous stage
Visits12.000
Cart2.40020%
Payment90037.5%
Purchase48053.3%

<Card title="From catalogue to purchase" subtitle="Last 30 days">
<Stat label="Conversion" value="4 %" detail="480 purchases from 12,000 visits" tone="success" />
<FunnelChart
  label="From catalogue to purchase"
  stages={[
    { key: "visitas", label: "Visits", value: 12000 },
    { key: "carrito", label: "Cart", value: 2400 },
    { key: "pago", label: "Payment", value: 900 },
    { key: "compra", label: "Purchase", value: 480 },
  ]}
/>
</Card>

Props

Import it with import { FunnelChart } from '@amset/ui'. Required props are marked.

PropTypeWhat it does
labelrequiredstringWhat is being measured. Required: a chart without a title does not inform.
stagesrequiredreadonly FunnelStage[]The stages, in order: `{ key, label, value }`.
classNamestringMerged with the library classes; it does not replace them.
errorReactNodeThe data has not arrived: it says so in the place of the drawing, with what is passed here.
format(value: number) => string—
loadingbooleanThe data is on its way.
tableVisiblebooleanAlso shows the table. For the screen reader it is always there.

It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.

CSS variables

These CSS variables are how you adapt it. Declare them on the component's selector, not on :root: the stylesheet redeclares them in the rule itself, and a declaration on the same element always wins.

VariableDefault
--amset-funnel-barvar(--amset-accent)
--amset-funnel-height2.25rem

How to change it

.amset-funnel {
  --amset-funnel-bar: ...;
  --amset-funnel-height: ...;
}

In the test bench

Every state and variant, to try one at a time, on its page at storybook.amsetui.com: