Xzero UI
Pro library

SunburstPro

A hierarchy in rings: click a segment and every arc swings around it as the new centre, with a breadcrumb back and a rolling total.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/sunburst
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/sunburst

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Sunburst } from "@/components/xzero/sunburst/sunburst";

const spend = {
  id: "all", label: "All teams",
  children: [
    { id: "platform", label: "Platform", children: [
      { id: "platform/compute", label: "Compute", children: [{ id: "api", label: "api-cluster", value: 18910 }, { id: "batch", label: "batch-workers", value: 8160 }] },
      { id: "platform/storage", label: "Storage", value: 8670 },
    ] },
    { id: "data", label: "Data", children: [{ id: "data/warehouse", label: "Warehouse", value: 31020 }] },
  ],
};

export function CloudSpend() {
  return <Sunburst data={spend} label="Cloud spend, September" formatValue={value => `$${(value / 1000).toFixed(1)}K`} />;
}

API reference

Sunburst

A hierarchy drawn as rings. Clicking a segment swings every arc around it as the new centre, the breadcrumb follows, and the centre label rolls to the new total.

PropTypeDefaultDescription
data (required)SunburstNode–The root: { id, label, value?, children? }. A branch's value is the sum of its children.
label (required)string–Names the chart for assistive technology.
formatValue(value: number) => string–Formats the centre value, legend, tooltip, and table.
depthnumber3Rings shown around the centre at once. Fewer levels below a zoomed node fill the full radius.
sizenumber340Largest diameter in pixels. The chart scales down to fit its container.
focusstring–Controlled id of the node in the centre.
defaultFocusstring–Initial centre when uncontrolled. Defaults to the root.
onFocusChange(id: string) => void–Called when a segment, breadcrumb, legend row, or the centre zooms.
legendbooleantrueLists the children of the centre with values and shares, synced with the arcs.
emptyLabelstring"No data yet"Shown in the centre when the total is zero.
classNamestring–Extra class on the figure.

Keyboard interactions

KeysAction
TabFocuses the chart and highlights the first segment.
ArrowLeft / ArrowRightMoves between sibling segments.
ArrowDown / ArrowUpMoves to the first child or back to the parent segment.
Enter / SpaceZooms into the highlighted segment.
Escape / BackspaceZooms out one level.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in advanced charts

Guidance for AI tools

Sunburst: A hierarchy in rings: click a segment and every arc swings around it as the new centre, with a breadcrumb back and a rolling total. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components