suiss/uim · Chart

Pie Chart Donut

A donut chart showing users by device, with a hollow center and small gaps between slices.

Pie Chart Donut is an open-source mobile chart from suiss/uim, drawn with react-native-svg for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Pie (donut) on iOS in light mode

A PieChart whose Pie uses innerRadius to leave the middle empty and paddingAngle to space the slices. chartData holds one record per device with a users count. Pressing a slice shows a tooltip.

Installation

$ pnpm dlx @esuiss/uim@latest add pie-chart-donut

The CLI also adds what it builds on: Card, Chart.

Manual

  1. Add the pieces it builds on: Card, Chart.

  2. Copy the source into components/charts/pie-chart-donut.tsx:

uniwind/components/charts/pie-chart-donut.tsx
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,
  Pie,
  PieChart,
} from "@/components/ui/chart"
  1. Update the import paths to match your project.

Usage

import { PieChartDonut } from "@/components/charts/pie-chart-donut"
<PieChartDonut />

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.