Charts A
Funnel
Stages with a layered halo and the conversion between columns.
Example
Funnel chart
Stages with a layered halo and conversion pills, smooth curves or sharp cuts, and tiles with each column's number.
<article class="u-chart-card">
<div class="u-chart-panel">
<div data-u="funnel" data-u-props='{
"label": "Sign-up",
"curve": true,
"stages": [
{"label": "Visited"},
{"label": "Created account"},
{"label": "Activated"},
{"label": "Subscribed"}
],
"periods": [
{"label": "Last 7 days", "delta": 6.1, "values": [2340, 1310, 820, 310]},
{"label": "Last 30 days", "delta": 3.4, "values": [9870, 5240, 3480, 1290]},
{
"label": "Last 90 days",
"delta": -1.8,
"values": [28900, 15100, 9700, 3650]
}
]
}'></div>
</div>
<h3 class="u-chart-title">Funnel chart</h3>
<p class="u-chart-desc">Stages with a layered halo and conversion pills, smooth curves or sharp cuts, and tiles with each column's number.</p>
</article>Installation
Just this chart, with the core and the tokens:
curl -fsSL unslop.leallabs.dev/i | sh -s add funnelNo dependency The chart file already brings its own shell.
The full card from the example, as HTML ready to paste:
curl -fsSL unslop.leallabs.dev/i | sh -s add chart-funnelFamily A: shell u-chart-card > u-chart-panel > the data-u, then h3.u-chart-title and p.u-chart-desc.
Props
They go in data-u-props, as JSON. Each item in periods becomes an option in the picker and the chart animates from the old data to the new.
| Prop | Type | Default | What it does |
|---|---|---|---|
label | string | no default | Small label at the top of the card. |
curve | boolean | true | Smooth curve between stages. false gives straight cuts. |
stages | array | no default | List of {label}, one per stage. |
periods | array | no default | List of {label, delta, values}. One value per stage. |
period | number | 0 | Index of the period that opens selected. |
Accessibility and keyboard
State and roles
| Where | Attribute | What it says |
|---|---|---|
| chart svg | role="img" and aria-label | "Label: stage value, ..." with the stage numbers. |
| period toggle | role="radiogroup", role="radio" | Current period in aria-checked. |
| period list | role="listbox", role="option" | Opens with aria-expanded and marks the option in aria-selected. |
Keyboard
| Key | Does |
|---|---|
| Left and right arrows | change the period in the toggle |
| Enter or Space | opens the period list |
| Up and down arrows | moves through the options |
| Esc | closes without changing |
| Tab | closes and moves focus on |
Events and API
No public events. The period change happens inside the card.