SunburstPro
A hierarchy in rings: click a slice to make it the centre, and every arc swings around it.
$
pnpm dlx shadcn@latest add @lode/sunburstLive preview
Cloud spend by team
September 2026 · click a ring to drill in
When to use
- Showing where a total comes from, one level at a time: spend by team, revenue by region and product.
- Comparing a part with its parent and with the whole in one view.
When not to use
- Flat categories: use a donut or bar chart.
- Exact comparisons between many small slices: use a sorted bar chart or treemap.
Installation
$
pnpm dlx shadcn@latest add @lode/sunburstPro components need an API key and the registry in components.json. See CLI and API keys.
1Install the dependencies
npm install motion lucide-react2Copy the source into your project
Usage
Import it from @/components/ui/sunburst after installing.
example.tsx
import { Sunburst } from "@/components/ui/sunburst";
const data = {
label: "All teams",
children: [
{ label: "Platform", children: [{ label: "Compute", value: 25600 }, { label: "Storage", value: 11600 }] },
{ label: "Data", children: [{ label: "Warehouse", value: 23700 }, { label: "Pipelines", value: 17900 }] },
],
};
export function Spend() {
return <Sunburst data={data} format={(n) => `$${(n / 1000).toFixed(1)}K`} />;
}API reference
Sunburst
Rings of a hierarchy around a centre. Clicking a slice makes it the centre.
| Prop | Type | Default | Description |
|---|---|---|---|
| data | SunburstNode | – | { label, value?, color?, children? }. Parents sum their children. |
| rings | number | 3 | Rings shown around the centre. |
| size | number | 340 | Diameter in px; shrinks to fit. |
| format | (n) => string | – | Values in the centre and legend. |
| legend | boolean | true | List of the current level beside the chart. |
| onFocusChange | (path: string[]) => void | – | Called when the centre changes. |
Keyboard interactions
| Keys | Action |
|---|---|
| Tab | Move through the legend and breadcrumbs |
| EnterorSpace | Drill into the focused group, or go back from the centre |
| Escape | Go up one level |
Accessibility
- Every group in the legend is a button with its value and share.
- The chart has a text summary; the breadcrumb marks the current level.
Motion
- Drilling swings every arc around the new centre on a spring.
- Respects reduced motion: changes jump instead.
Responsive behavior
- The rings scale to the container; the legend wraps below on narrow screens.
Performance
- One path per visible slice; nothing animates when idle.
Notes for AI
- Give leaves a value; parents are summed.
- Top-level groups take colours from the chart palette unless you set color; deeper rings are tints of their group.
This page as Markdown, for assistants and coding agents:
/components/sunburst/markdownThe full library index for assistants is at /llms.txt.
Related
Lode·227 doc pages·llms.txt