# Spend Breakdown

> An animated spend breakdown for React and shadcn, a donut of spending by category for each month.

A donut of where the money went. Switching months morphs each arc from its angle on screen, the centre label swaps to the hovered category while its amount rolls, and turning a category off flattens its arc.

- Tier: Eased Pro
- Interaction: Hover
- Page: https://eased.dev/components/spend-breakdown
- Installs: motion, d3-shape

## Install

Spend Breakdown ships with Eased Pro (https://eased.dev/#pricing). Members add the `@eased-pro` registry with their token (https://eased.dev/account), then run:

```bash
npx shadcn add @eased-pro/spend-breakdown
```

A donut of where the money went, with a toggleable legend.

```tsx
import { SpendBreakdown } from "@/components/eased/spend-breakdown/spend-breakdown";

<SpendBreakdown categories={[{ id: "infra", label: "Infrastructure", amount: 14906 }, …]} currency="USD" />
```

## Props

| Prop | Type | Default | |
|---|---|---|---|
| `categories` | `SpendCategory[]` | | `{ id, label, amount, color? }`, in a fixed order across periods so arcs morph in place. Colours default to `chartColor(i + 1)`. |
| `currency` | `string` | `"USD"` | |
| `totalLabel` | `string` | `"Total spend"` | Centre label at rest. |
| `hidden` / `defaultHidden` / `onHiddenChange` | `string[]` | `[]` | Categories turned off (at least one stays on). |
| `locale` | `string` | runtime | |

Under 26rem the donut stacks above the legend. Legend rows are toggle buttons (`aria-pressed`); hovering or focusing one lifts its arc and dims the rest.

**Motion signature:** the donut sweeps in once on first view; a new period morphs every arc from its angle on screen on the smooth spring; the centre label swaps and its amount rolls to the active category; turning a category off flattens its arc while the rest close the gap. Reduced motion: no sweep, no morph.
