# C donut chart 3

> Headcount — percentage labels on each slice

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/c-donut-chart-3).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/c-donut-chart-3
- Screenshot: https://shadcn.exchange/shot/cnippet/c-donut-chart-3/light.png
- Registry item: https://ui.cnippet.dev/r/c-donut-chart-3.json
- Categories: donut chart
- Listed: 2026-10-27, source last changed 2026-10-27

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/cnippet/c-donut-chart-3.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/donut-chart`, `@cnippet/chart-card`

## Files

### `registry/default/chart-variants/c-donut-chart-3.tsx`

```tsx
"use client";

import { ChartCard } from "@/registry/default/charts/chart-card";
import { DonutChart } from "@/registry/default/charts/donut-chart";

const data = [
  { department: "Engineering", people: 64 },
  { department: "Sales", people: 31 },
  { department: "Customer success", people: 22 },
  { department: "Marketing", people: 14 },
  { department: "Operations", people: 11 },
];

export default function TeamByDepartment() {
  return (
    <ChartCard
      className="max-w-md"
      description="142 people across five departments"
      title="Headcount"
    >
      <DonutChart
        category="people"
        className="h-60"
        data={data}
        index="department"
        showLabels
        valueFormatter={(value) => `${value} people`}
      />
    </ChartCard>
  );
}
```
