Charts
FunnelChart
Stages of a process with the conversion from the previous and from the first stage.
import '@reactloom/charts/styles.css';
import { FunnelChart } from '@reactloom/charts';Examples
Sign-up funnel
Use the arrow keys to move between data points, Home and End to jump to the first and last.
import { FunnelChart } from '@reactloom/charts';
const stages = [
{ stage: 'Visited', people: 12000 },
{ stage: 'Started sign-up', people: 4200 },
{ stage: 'Verified email', people: 3100 },
{ stage: 'Subscribed', people: 940 },
];
export default function Example() {
return <FunnelChart title="Sign-up funnel" data={stages} label="stage" value="people" />;
}Hiring pipeline
Use the arrow keys to move between data points, Home and End to jump to the first and last.
| Category | Hiring pipeline | Of previous | Of first |
|---|---|---|---|
| Applied | 640 | 100% | 100% |
| Screened | 180 | 28.1% | 28.1% |
| Interviewed | 48 | 26.7% | 7.5% |
| Offered | 9 | 18.8% | 1.4% |
| Hired | 7 | 77.8% | 1.1% |
import { FunnelChart } from '@reactloom/charts';
const pipeline = [
{ step: 'Applied', n: 640 },
{ step: 'Screened', n: 180 },
{ step: 'Interviewed', n: 48 },
{ step: 'Offered', n: 9 },
{ step: 'Hired', n: 7 },
];
export default function Example() {
return <FunnelChart title="Hiring pipeline" description="Most candidates leave at screening." data={pipeline} label="step" value="n" table="visible" />;
}API reference
| Prop | Type | Default |
|---|---|---|
datarequired | Row[] | — |
labelrequired | key or accessor | — |
valuerequired | key or accessor | — |
titlerequiredNames the figure. | string | — |
descriptionThe takeaway; a factual summary is generated when omitted. | ReactNode | — |
tableThe data table alternative. | 'toggle' | 'visible' | 'none' | 'toggle' |
height · valueFormat · formatValue · messagesAs on the other charts. | | — |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-active] | present when on |
Theme tokens it reads
--pl-color-fg-default --pl-color-fg-muted
Accessibility
- The chart is a figure named by its title and described by a summary; the drawing is hidden from assistive technology.
- The plot is one tab stop: arrow keys move between items and each is announced; the data table gives every value.
| Key | Action |
|---|---|
| Tab | Focus the plot |
| ← → ↑ ↓ | Move between items |
| Home / End | First / last item |
| Escape | Clear the highlight |
Usage guidelines
Do
- Order stages as people move through them.
Don’t
- Don't use a funnel for unrelated categories.