suiss/ui · Chart
Pie Chart Donut Text
A donut with the total number of users displayed in the center of the ring.
Pie Chart Donut Text 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 donut with the total shown in its center, so readers get the overall number and the breakdown in one glance. Prefer it over the plain donut when the total is the headline.
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:
-
Copy the source into
components/charts/pie-chart-donut-text.tsx:
- Update the import paths to match your project.
Usage
Replace chartData and the category entries in chartConfig; the center total is summed from the data automatically. Change the caption under the number to your unit, and adjust innerRadius if a longer number needs more room.
Notes
The center text sits on top of the chart but lets pointer events through, so slice tooltips still work.

A PieChart donut with small gaps and rounded slice corners. chartData holds one record per device with a users count. The total is summed from chartData and drawn as Text layered over the ring. Pressing a slice shows a tooltip.
Installation
The CLI also adds what it builds on: Card, Chart, Text.
Manual
-
Target iOS 17 or later.
-
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 chartData with your records; the center total recalculates from it. Update the users caption and chartConfig labels and colors to match. The component takes no props.
