All components (283)
Sunburst
Data · SunburstChart · .amset-sunburst
What it is and when to use it
A split by levels in rings: the inner one is the categories and each outer ring splits them into subcategories, with the size of their value. To see at a glance where the total comes from and where it weighs most.
When to use it
- Totals with a hierarchy (sales by country and channel, spending by department and item).
nodesare the first-level branches:{ key, label, value?, tone?, children? }. A branch is worth the sum of its children, so only the leaves carryvalue. Children inherit the tone of their branch.- Pressing a sector that has children makes it the root, with a breadcrumb to go back.
- Chart and legend sit side by side when they fit and the legend drops below when not; hovering a legend row marks its arc.
When not to
- A single layer of parts:
DonutChart. - Many parts without hierarchy:
TreemapChart. - Comparing values precisely:
BarChart.
Keyboard: Tab goes to the drawing and the arrows move from sector to sector, from the inside out and from branch to branch, with a spoken notice that says the full path.
Accessibility: it is an image (role="img") with a written summary and underneath goes a real table with the path of each part ("Sales › Spain › Web"). When hovering or moving with the arrows, the path and the value are read in a line under the drawing.
Fine-tuning: --amset-sunburst-size is the diameter. Each outer level gets a little lighter to read the depth even if the tone is the same.
What it looks like
| Path | Value | Share of total |
|---|---|---|
| Sales | 85 | 68% |
| Sales › Spain | 65 | 52% |
| Sales › Spain › Web | 40 | 32% |
| Sales › Spain › Store | 25 | 20% |
| Sales › France | 20 | 16% |
| Services | 30 | 24% |
| Services › Support | 18 | 14.4% |
| Services › Training | 12 | 9.6% |
| Others | 10 | 8% |
<SunburstChart
label="Revenue by line"
nodes={[
{ key: "ventas", label: "Sales", children: [{ key: "es", label: "Spain", value: 65 }, { key: "fr", label: "France", value: 20 }] },
{ key: "otros", label: "Others", value: 10 },
]}
/>Props
Import it with import { SunburstChart } from '@amset/ui'. Required props are marked.
| Prop | Type | What it does |
|---|---|---|
labelrequired | string | What is being measured. Required: a chart without a title tells nothing. |
nodesrequired | readonly SunburstNode[] | The first-level branches: `{ key, label, value?, tone?, children? }`. A branch is worth the sum of its children. |
className | string | Merged with the library classes; it does not replace them. |
error | ReactNode | — |
format | (value: number) => string | — |
loading | boolean | — |
tableVisible | boolean | — |
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-sunburst-size | 22rem |
How to change it
.amset-sunburst {
--amset-sunburst-size: ...;
}In the test bench
Every state and variant, to try one at a time, on its page at storybook.amsetui.com:
