SunburstChart

Sunburst chart component for hierarchical data

Usage

SunburstChart is based on the SunburstChart recharts component. It displays hierarchical data as concentric rings. In this storage example, the inner ring shows folders and the outer ring shows their contents:

Storage usage

import { SunburstChart } from '@mantine/charts';
import { Stack, Text } from '@mantine/core';
import { data } from './data';

function Demo() {
  return (
    <Stack align="center">
      <Text fw={500}>Storage usage</Text>
      <SunburstChart data={data} withLegend valueFormatter={(value) => `${value} GB`} />
    </Stack>
  );
}

Data format

Each node has a name. Leaf nodes have a value. Nodes with children show the sum of their children, or their own value if it is larger:

export const data = [
  {
    name: 'Projects',
    color: 'blue.7',
    children: [
      { name: 'client-app', value: 30 },
      { name: 'website', value: 12 },
      { name: 'experiments', value: 6 },
    ],
  },
  {
    name: 'Photos',
    color: 'teal.7',
    children: [
      { name: 'travel', value: 20 },
      { name: 'family', value: 12 },
    ],
  },
];

Nested data

Add another children array to show a deeper level. This example expands project folders to reveal how much space their dependencies use:

Project storage breakdown

client-app/node_modules uses 24 GB of the 48 GB in Projects

import { SunburstChart } from '@mantine/charts';
import { Stack, Text } from '@mantine/core';
import { data } from './data';

function Demo() {
  return (
    <Stack align="center">
      <Text fw={500}>Project storage breakdown</Text>
      <SunburstChart data={data} withLegend valueFormatter={(value) => `${value} GB`} />
      <Text size="sm" c="dimmed" ta="center">
        client-app/node_modules uses 24 GB of the 48 GB in Projects
      </Text>
    </Stack>
  );
}

Legend

Set withLegend to display a legend for top-level nodes. Hover over a legend item to highlight its branch:

import { SunburstChart } from '@mantine/charts';
import { data } from './data';
function Demo() {
  return (
    <SunburstChart
      data={data}
      valueFormatter={(value) => `${value} GB`}
      withLegend
    />
  );
}

Legend position

The legend is displayed below the chart by default. Set legendProps={{ position: 'top' }} to display it above the chart:

import { SunburstChart } from '@mantine/charts';
import { data } from './data';

function Demo() {
  return (
    <SunburstChart
      data={data}
      withLegend
      legendProps={{ position: 'top' }}
      valueFormatter={(value) => `${value} GB`}
    />
  );
}

Node color

color accepts theme colors and any valid CSS color. Children inherit their parent's color unless they set their own, like client-app below. Top-level nodes without color use a default palette:

import { SunburstChart } from '@mantine/charts';
import { data } from './data';

function Demo() {
  return <SunburstChart data={data} valueFormatter={(value) => `${value} GB`} />;
}

Stroke color

Use strokeColor to change the color of the stroke around each sector:

import { SunburstChart } from '@mantine/charts';
import { data } from './data';

function Demo() {
  return (
    <SunburstChart data={data} strokeColor="gray.3" valueFormatter={(value) => `${value} GB`} />
  );
}

Chart size

Use size prop to control the width and height of the chart:

import { SunburstChart } from '@mantine/charts';
import { data } from './data';

function Demo() {
  return (
    <SunburstChart
      data={data}
      size={400}
      maw="100%"
      miw={0}
      valueFormatter={(value) => `${value} GB`}
    />
  );
}

Gap

Use gap prop to control the spacing between sectors and rings:

Gap
import { SunburstChart } from '@mantine/charts';
import { data } from './data';

function Demo() {
  return <SunburstChart data={data} valueFormatter={(value) => `${value} GB`} gap={1} />;
}

Inner radius

Use innerRadius prop to control the size of the empty circle in the center of the chart:

Inner radius
import { SunburstChart } from '@mantine/charts';
import { data } from './data';

function Demo() {
  return <SunburstChart data={data} valueFormatter={(value) => `${value} GB`} />;
}

Start and end angle

Use startAngle and endAngle props to draw a part of the ring. Angles are in degrees, 0 points to the right and angles grow counterclockwise. Without endAngle, the chart draws a full circle from startAngle:

import { SunburstChart } from '@mantine/charts';
import { data } from './data';

function Demo() {
  return (
    <SunburstChart
      data={data}
      startAngle={180}
      endAngle={0}
      valueFormatter={(value) => `${value} GB`}
    />
  );
}

Labels

Set withLabels to display value labels inside sectors. Labels that do not fit are hidden; increase size to give them more space. This example shows sales by category and product:

Sales by category · October 2026

import { SunburstChart } from '@mantine/charts';
import { Stack, Text } from '@mantine/core';
import { data } from './data';

function Demo() {
  return (
    <Stack align="center">
      <Text fw={500}>Sales by category · October 2026</Text>
      <SunburstChart data={data} withLabels withLegend valueFormatter={(value) => `$${value / 1000}k`} />
    </Stack>
  );
}

Value formatter

Use valueFormatter to format values in the tooltip and labels:

Sales by category · October 2026

import { SunburstChart } from '@mantine/charts';
import { Stack, Text } from '@mantine/core';
import { data } from './data';

function Demo() {
  return (
    <Stack align="center">
      <Text fw={500}>Sales by category · October 2026</Text>
      <SunburstChart
        data={data}
        valueFormatter={(value) =>
          value.toLocaleString('en-US', {
            style: 'currency',
            currency: 'USD',
            maximumFractionDigits: 0,
          })
        }
      />
    </Stack>
  );
}

Disable tooltip

To disable the tooltip, set withTooltip={false}:

import { SunburstChart } from '@mantine/charts';
import { data } from './data';

function Demo() {
  return (
    <SunburstChart
      data={data}
      withTooltip={false}
      withLabels
      valueFormatter={(value) => `${value} GB`}
    />
  );
}