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.
stagesare 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
| Stage | Value | of the previous stage |
|---|---|---|
| Visits | 12.000 | |
| Cart | 2.400 | 20% |
| Payment | 900 | 37.5% |
| Purchase | 480 | 53.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.
| Prop | Type | What it does |
|---|---|---|
labelrequired | string | What is being measured. Required: a chart without a title does not inform. |
stagesrequired | readonly FunnelStage[] | The stages, in order: `{ key, label, value }`. |
className | string | Merged with the library classes; it does not replace them. |
error | ReactNode | The data has not arrived: it says so in the place of the drawing, with what is passed here. |
format | (value: number) => string | — |
loading | boolean | The data is on its way. |
tableVisible | boolean | Also 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.
| Variable | Default |
|---|---|
--amset-funnel-bar | var(--amset-accent) |
--amset-funnel-height | 2.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:
