suiss/ui · Chart
Pie Chart Legend
A donut with a legend beneath it that lists every category and its color.
Pie Chart Legend 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 a legend underneath listing every category and its color. Pick it when a chart has enough slices that labels around the ring would get crowded.
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-legend.tsx:
- Update the import paths to match your project.
Usage
Replace chartData and add a label and color for each category to chartConfig; the legend reads both from there. Keep nameKey on the legend content set to your category field so the names resolve.

A PieChart donut with a ChartLegend that lists every slice from chartConfig. chartData holds one record per device with a users count. Pressing a slice shows a tooltip.
Installation
The CLI also adds what it builds on: Card, Chart.
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 and keep dataKey and nameKey in step with your field names. Add one entry per slice to chartConfig with its label and color; the component takes no props.
