suiss/ui · Chart
Pie Chart Interactive
A storage breakdown donut with a device switch, hover-linked list and lifted slices, plus a linear usage bar.
Pie Chart Interactive is an open-source chart from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
A storage breakdown with a Phone and Cloud switch, a stacked usage bar, a donut whose hovered slice lifts out and a list linked to it. The center shows the used total or the hovered category, and the slices morph when you switch devices. Use it as a reference for a rich part-to-whole view with linked controls.
Installation
CLI
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Manual
- Install the dependencies:
-
Add the pieces it builds on: Card, Chart, Toggle Group.
-
Copy the source into
components/charts/pie-chart-interactive.tsx:
- Update the import paths to match your project.
Usage
Replace STORAGE with your own sources, each with a total and the size of every category, and list all categories in KINDS. Add a label and color for each category to chartConfig; the free space is computed from the total. Add another source to STORAGE to get another toggle.
Notes
Highlighting works with a mouse over the slices, the bar or the list, but list rows aren't focusable, so keyboard users only get the totals. Changes in the center readout are announced through a live region, and the morph animation is skipped when reduced motion is preferred.

A Card with a ToggleGroup that switches between phone and cloud storage, a stacked usage bar, a PieChart donut and a list of categories. Sizes come from the STORAGE record, and free space is the total minus what is used. Pressing a slice or a list row selects that category: its slice lifts outward, other segments in the bar dim, and the center text shows its size and share. Pressing it again returns to total used. The donut sets isAnimationActive={false} and draws without the enter animation.
Installation
The CLI also adds what it builds on: Card, Chart, Text, Toggle Group.
Manual
- Install the dependencies:
-
Add the pieces it builds on: Card, Chart, Text, Toggle Group.
-
Copy the source into
components/charts/pie-chart-interactive.tsx:
- Update the import paths to match your project.
- Install the dependencies:
-
Add the pieces it builds on: Card, Chart, Text, Toggle Group.
-
Copy the source into
components/charts/pie-chart-interactive.tsx:
- Update the import paths to match your project.
-
Add the pieces it builds on: Card, Chart, Text, Toggle Group.
-
Copy the source into
components/charts/pie-chart-interactive.tsx:
- Update the import paths to match your project.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Set
minSdkto 24 or higher and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Replace STORAGE with your devices, totals and per-category sizes, and keep KINDS, chartConfig and SWATCH in sync when adding categories. The component takes no props.
