Sunburst chart
A tree as rings round a centre, each arc as large as its value. Press an arc to zoom in until it rings the centre; the hovered arc and its path to the centre stay bright while the rest step back, and new data moves every arc from where it is.
Examples
Bundle size
Three levels as rings, each arc in its package’s colour, a step nearer the background for each level, with its name on it where it fits. Press a ring to zoom in until it rings the centre; the centre, SunburstChartPath above it, or Escape zooms back out. Another release moves every arc from where it is.
Centre
SunburstChartCentre shows the total in the hole, and the value and name of the arc under the pointer.
No hole
innerRadius={0} fills the middle, and labels='none' leaves the arcs bare for a small card, with the names in the legend and the tooltip. With no hole to press, SunburstChartPath is the way back out.
Installation
npx shadcn@latest add https://kinoui.com/r/sunburst-chart.json- Files
lib/dates.tslib/chart-math.tslib/chart-scale.tslib/chart-frame.tslib/refs.tslib/reduce-motion.tslib/resize.tslib/live.tsxlib/chart-live.tslib/chart-live-clock.tsxlib/scroll.tslib/swap.tsxlib/popup.tslib/glide.tsxlib/keys.tsxcomponents/kino/kbd.tsxcomponents/kino/tooltip.tsxlib/cut.tsxlib/number-format.tslib/roll.tsxlib/run-progress.tscomponents/kino/animated-number.tsxlib/announce.tscomponents/kino/spinner.tsxcomponents/kino/button.tsxlib/controllable.tslib/chart-root.tsxlib/chart-state.tslib/chart-agent.tslib/chart-base.tsxlib/chart-cartesian-reader.tslib/chart-cartesian.tsxlib/chart-list.tsxlib/chart-list-reader.tslib/chart-tree-reader.tslib/chart-flow-reader.tslib/chart-grid-reader.tslib/highlight.tscomponents/kino/chart.tsxlib/chart-centre.tsxlib/chart-radial.tsxlib/chart-tiles.tscomponents/kino/separator.tsxlib/list-rows.tsxlib/grip.tslib/panel.tsxcomponents/kino/menu.tsxcomponents/kino/breadcrumb.tsxlib/chart-tree-path.tsxlib/placeholder.tscomponents/kino/sunburst-chart.tsx- Packages
@ui-sdk/core@ui-sdk/reactclass-variance-authorityd3-arrayd3-hierarchyd3-shape- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
The CLI keeps any of these colours your project already has, such as the chart colours shadcn init writes. To use Kino’s, set them in your global CSS:
:root { --chart-1: oklch(0.42 0.1 248); --chart-2: oklch(0.53 0.12 222); --chart-3: oklch(0.6 0.11 185); --chart-4: oklch(0.65 0.17 132); --chart-5: oklch(0.72 0.154 106.7); --chart-accent: oklch(0.795 0.171 71.2);}.dark { --chart-1: oklch(0.6 0.15 255); --chart-2: oklch(0.7 0.13 222); --chart-3: oklch(0.79 0.13 185); --chart-4: oklch(0.82 0.15 128); --chart-5: oklch(0.72 0.154 106.7); --chart-accent: oklch(0.795 0.171 71.2);}API reference
SunburstChart
The chart: a <figure> named by label, which lays out and draws the arcs and holds the chart’s parts. It shows the part in view as up to three rings round the centre, fewer where the tree is shallower there, so its rings fill the room. Other props go to the figure. The props from data to messages are the ones every chart takes, less those for a value axis, an order and a pick: a press zooms instead.
SunburstChartCentre
The words in the hole: the worth of the part in view, under valueLabel at the whole or the part’s name once zoomed in, and the value and name of the arc under the pointer or the keys, rolling in as they change. A press on the hole zooms back out a level.
SunburstChartPath
The way back out, above the plot and under a legend at the top: Kino’s Breadcrumb, with a button for each part above the one in view, the whole first, and the part in view last. It is there before the first zoom too, so zooming never moves the plot, and a long path folds into a menu.
ChartTooltip
What is under the pointer or the focus, in the chart’s own words: on a chart with series, the values of the category or the time. It shows at once and slides from one to the next. Other props go to its popup.
ChartLegend
A toggle for each series that shows and hides it. Pointing at one, or focusing it, brings its series forward. Takes position, top or bottom.
Data attributes
CSS variables
Accessibility
- The arcs are one stop in the tab order: a slider over the arcs in view, depth first, each part before its own parts. The arrow keys step through them, Home and End go to the first and last, and each arc’s name, value, share of its parent and of the whole, and level are read as the slider’s value.
- Enter or Space on an arc with parts zooms into it, and the keys start again from the first arc there; once the tooltip is closed, Escape zooms back out.
SunburstChartPathis a row of buttons for the same, and each zoom is announced in a status region. - A hidden table holds every arc in view with the path above it, its value, its share of its parent and its share of the whole, for screen readers and for copying.
- Labels show only where they fit whole, near white or near black for the arc’s colour; an arc too small for one keeps its name in the tooltip, the table and the slider.
- Branches are named in the legend and the tooltip, so none relies on colour alone;
patternsadds a pattern too. Forced colours draw each branch in a system colour. - When the system asks for less motion, the arcs land at once, with no move, and only their colours and opacity fade.
- The chart is a
<figure>named bylabel. - Escape closes the tooltip and nothing above the chart.
- The legend’s toggles say whether each series shows. When every series is hidden, a button shows them all again and takes the focus.
For agents
What an agent reads on this example with snapshot(), and the actions it can call with act().
The Agent bridge page sets up snapshot() and act() in your app.