suiss/uim · Chart

Pie Chart Interactive

A storage breakdown donut for phone and cloud, with a selectable list and a usage bar.

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

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

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

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

Manual

  1. Install the dependencies:
npx expo install cn
  1. Add the pieces it builds on: Card, Chart, Text, Toggle Group.

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

uniwind/components/charts/pie-chart-interactive.tsx
import { cn } from "cn"
import * as React from "react"
import { Pressable, View } from "react-native"
import { Card, CardContent, CardHeader } from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  Pie,
  PieChart,
} from "@/components/ui/chart"
import { Text } from "@/components/ui/text"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"

type Device = "phone" | "cloud"

type Kind =
  1. Update the import paths to match your project.

Usage

import { PieChartInteractive } from "@/components/charts/pie-chart-interactive"
<PieChartInteractive />

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.