Controls

Spending Ring

Effect
Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Spending Ring
Spent$2,840

Spent in October
CategorySpentBudget
Food$640$600
Food, Groceries$380
Food, Dining$190
Food, Coffee$70
Rent$1,400
Transport$260
Transport, Transit$120
Transport, Rideshare$90
Transport, Fuel$50
Fun$310$250
Fun, Concerts$160
Fun, Games$90
Fun, Books$60
Bills$230

Spending Ring

A ring of thick tiles showing where the money went, where each category opens into a ring of its own parts.

Installation

npx shadcn@latest add ikislay/pixel-ui/spending-ring

How to use

import { SpendingRing } from "@/components/ui/spending-ring"
const data = [
{
label: "Food",
value: 640,
budget: 600,
children: [
{ label: "Groceries", value: 380 },
{ label: "Dining", value: 190 },
{ label: "Coffee", value: 70 },
],
},
{ label: "Rent", value: 1400 },
{ label: "Transport", value: 220 },

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
data*
{ label: string; value: number; budget?: number; color?: string; children?: { label: string; value: number; budget?: number; color?: string }[] }[]

One tile per category, clockwise from the top. A category with children opens into them; parts without a color take shades of their category.

label*
string

Names the chart for screen readers and captions its data table.

format
(value: number) => string

Formats values wherever the chart shows them. Defaults to short numbers like 12.4K.

thickness
number

Width of the ring in chart units, out of a 200 unit square.

totalLabel
string

The caption above the total in the center.

className
string

Merged onto the root element.