Kinetik UI

Donut Chart

.md

A ring of rounded slices that sweeps in; tap a slice to bring it forward and read its share in the middle.

v1.0.0Live on web@shopify/react-native-skiareact-native-gesture-handlerreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add donut-chart

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/donut-chart.json

Install manually

  1. Install dependencies
    npx expo install @shopify/react-native-skia react-native-gesture-handler react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/donut-chart.tsx
    View source files

Usage

import { DonutChart } from '@/components/kinetik/donut-chart';

<DonutChart
  accessibilityLabel="Spending by category"
  data={[
    { label: 'Rent', value: 1240 },
    { label: 'Groceries', value: 420 },
    { label: 'Transport', value: 160 },
  ]}
  formatValue={(v) => `$${v}`}
/>;

Slices default to a monochrome ramp of the theme's strongest ink; give a slice a color to pick your own. The legend under the ring lists every slice with its share and value.

When to use

  • Parts of a whole, with a few slices: budgets, storage, time spent.
  • Summaries where the total matters as much as the split.

When not to use

  • More than about six slices; small ones become hard to see and to tap.
  • Comparing values that do not add up to a whole. Use Bar Chart.

Notes

  • Tap a slice or its legend row to select it; tap it again, or the middle of the ring, to clear.
  • Gaps stay even because the rounded caps are taken out of each slice's sweep.
  • The ring sweeps in whenever the data changes.

Props

DonutChartProps

PropTypeDefaultDescription
datarequiredreadonly DonutSlice[]—
accessibilityLabelrequiredstring—A summary of what the chart shows, e.g. "Spending by category".
sizenumber200Diameter of the ring. Defaults to 200.
thicknessnumber18Ring thickness. Defaults to 18.
gapnumber6Gap between slices, in degrees. Defaults to 6.
centerLabelstring'Total'Shown in the middle under the total. Defaults to 'Total'.
formatValue(value: number) => string(v) => String(v)
onSelect(index: number | null) => void—Called with the selected slice, or null when the selection clears.
legendbooleantrueA list of slices under the ring. Defaults to true.
hapticsbooleantrueA tick when a slice is selected. Defaults to true.
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
Slice paths are built once per data change; the sweep and the selection are shared values read by one Skia canvas.
Measured

Pixel 9 emulator, API 35, release build · interaction median 1.05× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 153 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
The ring appears complete and selection changes without the bounce.
Screen readers
The ring reads as an image with every slice and value; legend rows are buttons with a selected state.
Touch target
Legend rows are 44 pt tall and full width; the ring itself is also tappable.

Source files

components/kinetik/donut-chart.tsx is in the Code tab of the preview above.