Spend Donut, animated React component
- Pro
- Dashboards
- Hover
- Spring
Spend Donut
A monthly budget donut: the slice you point at slides out of the ring and thickens while the centre rolls to its amount. Switch month and every slice re-measures itself in one continuous spring sweep. Also includes Spend Ring, a month of spending as a ring: point at a category and its arc swells, click it and the arc unwinds into a straight budget bar.
Spend Ring
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| thickness | number | 18 | Ring thickness in px (220px viewBox). The pointed-at slice grows by 6. |
| gap | number | 4 | Clear space between slices in px; the round caps are accounted for. |
| autoplay | boolean | false | Points at each category in turn and changes month every ~8s until someone interacts. |
| SpendRing.title | string | "Spending" | Heading above the ring. |
| SpendRing.monthNames | string[] | MONTHS | month names, oldest first; each category's `months` lines up with these |
| SpendRing.categories | SpendCategory[] | DEFAULT_CATEGORIES | The slices of the ring, each as { id, label, color, budget, months, txns }. |
| SpendRing.currency | string | "$" | Currency symbol shown before amounts. |
| SpendRing.onSelect | (category: SpendCategory | null) => void | — | Called with the chosen category, or null when the selection is cleared. |
| SpendRing.enableSound | boolean | true | Soft synthesised sounds as you use it. They also follow the site-wide sound switch. |
| SpendRing.volume | number | 0.6 | Sound level, 0 to 1. |
| SpendRing.autoplay | boolean | false | Plays a short demo by itself until the visitor touches it. Never runs under reduced motion. |
| SpendRing.className | string | "" | Extra classes for the outer element. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Spend Donut is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
How Spend Donut works
A monthly budget as a donut. Point at a slice (or its row, or arrow through the rows) and it slides out from the ring and thickens while the centre rolls to that category. Change month and every slice re-measures itself in one continuous sweep instead of jumping.
The source, the install command and the build prompt come with Pro.
Spend Donut questions
How do I install Spend Donut?
Run `npx shadcn@latest add @nexus-labs/spend-donut`. It adds the component and installs framer-motion. It is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
Can I pass my own categories and amounts?
Not through props. The five categories and the Aug, Sep and Oct figures are the `CATS` and `MONTHS` constants at the top of the file, and the "of $4,000 budget" label is fixed text, so edit those to show your own numbers.
Which props change the ring?
`thickness` sets the ring width in px (default 18) and the slice you point at grows by 6. `gap` sets the space between slices in px (default 4). `autoplay` is off by default and stops as soon as someone interacts.
Can I use it with the keyboard?
Yes. Each category row is a button: focusing it highlights its slice, and Arrow keys, Home and End move between rows. A live region announces the amount, and the component follows the visitor's reduced-motion setting through Framer Motion's `MotionConfig`.

