suiss/uim · Chart

Pie Chart Active

A donut chart where one slice is pulled outward with an extra outer ring to highlight it.

Pie Chart Active 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 (active) on iOS in light mode

A PieChart donut inside a Card, showing users by device. chartData holds one record per device with a users count. The Pie shape callback enlarges the slice at index ACTIVE and adds a thin arc outside it. Pressing a slice shows a tooltip with its name and value.

Installation

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

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-active.tsx:

uniwind/components/charts/pie-chart-active.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 { PieChartActive } from "@/components/charts/pie-chart-active"
<PieChartActive />

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; change ACTIVE to highlight a different slice. The component takes no props.