StealThis .dev

Banking — Spending Breakdown

A trust-first spending breakdown widget for banking and fintech dashboards. An SVG donut chart splits the month's spend by category, with the running total centred inside the ring and a colour-matched legend listing every category by amount and share. Hovering or clicking a slice highlights its legend row and surfaces that category's amount in the centre, while a month switcher steps through four months of real-feeling data and recomputes totals, the budget pill, and a month-over-month delta. Tabular figures, keyboard support, and vanilla JS only.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Spending Breakdown

A compact spending widget for a banking dashboard. An SVG donut, drawn from stroke-dasharray arcs, splits the selected month’s spend into seven categories — Housing, Groceries, Dining, Transport, Shopping, Subscriptions, and Health — each in its own colour. The running total sits in the centre of the ring in tabular figures, with a small month-over-month delta below it that turns green when spending drops and red when it climbs.

The whole thing is interactive. Hovering a slice previews its category by dimming the rest of the ring and lighting up the matching legend row; clicking a slice or legend row pins that selection so the centre figure swaps to show just that category’s amount and percentage. The legend lists every category with its amount right-aligned and its share of total spend, and a footer summarises the transaction count, a top merchant, and a budget pill that flips between on track, near limit, and over budget.

A pill-style month switcher steps through four months of fictional data — using the arrow buttons or the left/right keys — recomputing the donut, legend, totals, and budget state on each change while keeping your category selection where it still applies. Press Escape to clear a selection. Amounts use font-variant-numeric: tabular-nums so digits never shift, a toast() helper confirms month changes and exports, and the layout collapses to a single column down to 360px.

Illustrative UI only — not real banking software or financial advice.