Bruno DelorenceBruno
Appearance
Appearance

Choose your reading theme.

Contact

Budget pacing

New

Each team’s budget paced to the end of the quarter, with the overrun hatched past the Budget line, and a card that moves money from a team with room to one that runs out.

budget-pacing/budget-pacing.tsx
Live · interactive

Q4 budgets by team

Day 17 of 92 · $223k of $1.2M spent
  • Spent
  • Forecast to Dec 31
  • Over budget

Marketing runs out on Dec 4 at this pace. G&A will leave $27k unused.

Move budget

Orrin suggests covering Marketing from G&A
FromTo
  • Marketing
  • G&A
Over $15k needs Mira to approve

The live component, numbered part by part. Every measurement is read from it as it is drawn. Point at a row to outline its part, or at a part to find its row.

The choices it offers, each value drawn live and the default marked, with how to pick one.

When to use

  • Budgets split across a handful of teams for a period, where the question is who will run over at the current pace, not only who has spent the most.
  • A finance or ops review that needs the spend so far, the forecast to the period’s end and the overrun on one shared scale, so the rows compare at a glance.
  • A suggestion to act on: moving money from a team with room to one that runs out, with the effect on both shown before anything changes.
  • Moves that need a sign-off over a limit: the footer names who approves and asks them, under it the move goes through at once.

When not to use

  • Spend over time. A line or a burn-down chart shows the curve; the pacing rows only show where today’s pace lands.
  • Dozens of cost centres. Past eight or ten rows, group them, or rank the furthest over and fold the rest.
  • Line-item spending or invoices. Use a table with filters; a team’s row says nothing about what it bought.
  • Budgets that are not meant to be spent evenly. The forecast is today’s pace carried to the end; for lumpy spend, forecast from the plan instead.
  • Approvals with several steps. The card asks one person; a real workflow needs a request with its own status and history.

Reading the rows

  • One scale per row, from nothing to 150% of the team’s own budget, so the Budget line sits at two thirds for everyone and a small team compares with a large one by pace, not by size.
  • The spent bar is in the team’s colour; the dimmer bar runs on to the forecast’s dot; past the Budget line the overrun is hatched in red.
  • The Today line runs through every row: a spent bar well past it is spending ahead of the calendar.
  • The share at the end of the row is the forecast over the budget, the same figure the label reads out.

Moves and approval

  • The suggestion covers the team furthest over from the one with the most to spare; after a move, the next one is picked from the budgets as they are now.
  • The gap chip is To’s overrun to the $1k, never more than From can spare. It is only there when To is over.
  • An amount past what From has left turns red, the footer says how much there is, and Move is off.
  • Move applies at once and calls onMove; Undo in the toast puts both budgets and the picks back, and the toast stays until it is used or the next move replaces it. Ask calls onAskApproval and reads Asked until the move changes.

Each one drawn with the component itself, used well or badly.

The card is read in a review, often aloud: every word should match what the finance team calls things.

  • Team names of a word or two, as people say them: Engineering, G&A. Long names are cut short with an ellipsis in the rows.
  • Budgets, spend and forecasts in whole dollars; the card rounds them to $43k or $1.2M itself.
  • The assistant’s and the approver’s names are a person’s or a tool’s name, nothing more: the subtitle and the footer build the sentence around them.
  • A forecast you can stand behind: the quarter view draws the forecast you pass, so feed it from the plan or the run rate your team trusts.

You can add this component with the shadcn CLI or by hand:

Into components/budget-pacing of any React project, with no setup:

Terminal
npx shadcn@latest add https://brunodelorence.com/r/budget-pacing.json

Either way it needs React 19 and a bundler that supports CSS Modules, such as Next.js or Vite. It has a dark colour scheme: it follows your page’s color-scheme, light unless the page sets one, or its colorScheme prop, with nothing to configure. Browsers without light-dark() show it light.

Usage

budget-review.tsx
import { BudgetPacing, type Team } from './budget-pacing';const teams: Team[] = [  {    id: 'growth',    name: 'Growth',    tone: 'pink',    budget: 60_000,    spent: 14_200,    forecast: 76_800,    phasing: [0.4, 0.3, 0.3],  },  {    id: 'platform',    name: 'Platform',    tone: 'blue',    budget: 210_000,    spent: 31_500,    forecast: 170_400,    phasing: [0.33, 0.33, 0.34],  },];export function BudgetReview() {  return (    <BudgetPacing      teams={teams}      day={17}      approver="Mira Castell"      approvalLimit={15_000}      onMove={(move) => console.log('Move', move)}      autoplay={false}    />  );}

Each state below is a live instance, locked so you can study it.

The pieces it is built from, each with its measurements read live.

Below are variations of this component, each live, with its code.

Budgets only

The pacing card on its own, for a report or a review: the rows, the tooltip and the insight, with no Move card under them.

Everyone on pace

A calm quarter: every team lands inside its budget, nothing turns red, there is no gap to fill and the assistant has nothing to suggest.

Small move, no approval

A four-team studio where Product runs a little over: the gap is under the $15k limit, so the footer needs no one and Move goes straight through.

Monthly view

October on its own: each team’s planned share of the quarter for the month, paced to Oct 31, where Sales rather than Marketing runs furthest over.

Two stacked cards for a finance review. The first draws every team on one scale from nothing to 150% of its budget: what it has spent, where it lands at today’s pace, and the overrun hatched in red past the Budget line, with Today and Budget marked under the rows and a line on who runs out first. Month / Quarter recomputes it all. The second starts from the assistant’s suggestion (cover the team furthest over from the one with the most to spare): pick From and To, type the amount or take the chip that fills the gap, and see both teams move before and after. Over the approval limit, the footer names who signs off; Move applies it to the budgets above, with Undo. Light and dark.

  • Every row shares one scale, from nothing to 150% of the team’s own budget, so the Budget line sits at two thirds for everyone and the rows compare by pace, not by size. The track takes the spent, forecast and in-budget positions as custom properties; the bars and the dot are absolutely placed from them and slide when they change.
  • Under the bars, the zone past 100% is shaded and the Budget and Today lines run through every row: they sit over the track column alone, from the same column widths as the rows’ grid, so they line up without measuring anything.
  • The quarter view uses each team’s forecast to Dec 31; the month view takes the team’s planned share of the quarter for this month and carries the month’s spend at its pace to the month’s last day. The insight finds the team furthest over and the day its budget runs out at the pace still to come, and the team that will leave the most unused.
  • The suggestion is the team furthest over, covered from the one with the most to spare; the gap chip is To’s overrun to the $1k, never more than From can spare. After a move, the next suggestion is picked from the budgets as they are now.
  • Hovering a row shows its dollars at the pointer’s x, clamped inside the chart; focusing it puts the tooltip on its forecast’s dot. Pressing a row picks it for a move: as To when it is over, as From when it is not.
  • From and To are menu buttons placed on the stage in its own px, so a scaled gallery card keeps them under their trigger. Picking the team already on the other side swaps them, as the arrow does. The amount is a field: digits only, the arrow keys step it by $1k (Shift: $10k).
  • Move adds to a list of moves the budgets are computed from, so Undo only puts the list back. Ask sends the move to `onAskApproval` and holds the button at Asked until the move changes.
  • While on screen and untouched, a demo pointer hovers two rows, switches to the month and back, tries $10k and the gap, moves the budget and undoes it. Any real input hands it over; it comes back after 9 s of quiet.
PropTypeDefaultDescription
teamsTeam[]six teams of a 120-person companyThe teams: id, name, a tone (blue, amber, pink, cyan, violet, grey, green, orange), the quarter’s budget, spent so far, the forecast to the quarter’s end, the budget’s split over its three months, and optionally the month’s spend so far.
daynumber17Today, as the day of the quarter (1–92). It places the Today line and sets the month.
assistantstring'Orrin'Who suggests the move, in the Move card’s subtitle.
approverstring'Mira Castell'Who signs off on a move over the limit; their first name is on the Ask button.
approvalLimitnumber15000Moves over this many dollars name the approver and show Ask.
defaultPeriod'month' | 'quarter''quarter'The period it opens on.
showMovebooleantrueThe Move budget card under the budgets. Without it, rows only show their tooltip.
onMove(move: Move) => void—Called with { from, to, amount } when Move is pressed.
onAskApproval(move: Move) => void—Called with the move when Ask is pressed.
defaultStateBudgetPacingState—Opens locked in a moment (a period, a hovered row, From, To and the amount, a move made, the approver asked, a menu open) with the demo off.
autoplaybooleantrueWhile on screen and untouched, a demo pointer shows the main interactions. Any real input stops it.
colorScheme'light' | 'dark' | 'system'—Light or dark colours, or the reader’s; without it, the page’s color-scheme.
classNamestring—Classes for the stage.

Rows in words

Each team row is a button whose label reads it in full: the share of budget, how far over or under, then spent, forecast and budget. The bars are hidden from assistive technology. Being over is never shown by colour alone: the overrun is hatched and the share reads over 100% (WCAG 1.4.1, Use of color).

Keyboard

  • Tab reaches each row; its tooltip shows on keyboard focus. Escape hides the tooltip wherever the focus is, and the pointer can move onto it without losing it (WCAG 1.4.13, Content on hover or focus). Enter or Space picks the row for a move when the Move card is there.
  • Month / Quarter is a radio group with one tab stop; the arrow keys flip the period.
  • From, To and More actions open menus that move with the arrow keys, Home and End, and close on Escape with the focus back on their button.
  • In the amount field the up and down arrows step it by $1k, or $10k with Shift.

Announcements and errors

  • A change of period is read out in a polite live region; every move and request is reported in a role="status" toast (WCAG 4.1.3, Status messages).
  • An amount past what From has left marks the field invalid, and the footer, which the field points to with aria-describedby, says how much is left (WCAG 3.3.1, Error identification).
  • The toast with Undo stays until Undo is used or the next move or request replaces it; other toasts leave after about six seconds, never while the pointer or the focus is on them (WCAG 2.2.1, Timing adjustable).

Targets, contrast and motion

  • The smallest controls are the period segments (26 px tall), the amount chips (28 px) and the swap button (30 × 30 px), all above the 24 × 24 px minimum; Undo in the toast has its hit area grown to 24 px tall (WCAG 2.5.8, Target size).
  • Text, the axis labels included, is at least 4.5:1 on its surface in both schemes, and the team colours, the Budget and Today lines and the edges of the chosen period and chip at least 3:1 on the panel (WCAG 1.4.3 and 1.4.11).
  • The demo pointer stops for good at the reader’s first input (WCAG 2.2.2, Pause, stop, hide). Under reduced motion nothing slides or fades, and the demo never plays.

In this build

  • Each card is a section named by its title. Each team row is a button whose label reads it in words: “Marketing: forecast 142% of budget, $18.1k over. Spent $11.3k, forecast $61.1k, budget $43k.” The bars themselves are hidden from assistive technology.
  • The row’s tooltip is a role="tooltip" the row points to with aria-describedby; it shows on hover and on keyboard focus, and Escape hides it.
  • Month / Quarter is a radiogroup with one tab stop, moved with the arrow keys; the change is read out in a polite live region.
  • From, To and ··· are menu buttons; their menus move with the arrows, Home and End and close on Escape with the focus back on their button. The swap button and the amount field are labelled; the field is marked invalid when the amount is more than From has left, and the footer says why.
  • Every move and request is reported in a status toast; Undo is a real button in it. Under reduced motion nothing slides or fades and the demo never plays. The demo pointer is decorative.

The complete source behind this demo. Open source under the MIT license, © 2026 Bruno Delorence: copy it, change it, ship it.

budget-pacing.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import {  useEffect,  useEffectEvent,  useId,  useMemo,  useRef,  useState,  type KeyboardEvent as ReactKeyboardEvent,} from 'react';import { MoveTrack, PacingChart, isOver, type Hover } from './chart';import {  QUARTER,  TEAMS,  dateOf,  dollars,  gapOf,  money,  paceOf,  percent,  periodLabels,
chart.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useEffect, useId, useRef, type CSSProperties } from 'react';import { money, percent, type Pace } from './data';import styles from './budget-pacing.module.css';/* * The pacing chart: a row per team on one scale from nothing to 150% of its budget. The spent bar * in the team's colour, the forecast to the period's end dimmer and ending on a dot, and past the * Budget line the overrun hatched in red. Behind the rows: the shaded zone from 100% to 150%, the * Budget line and today's dotted line, labelled under the last row. * * Hovering a row (or focusing it) shows a tooltip with its dollars, at the pointer's x or on its * forecast's dot. The pointer can move onto the tooltip without losing it, and Escape hides it * wherever the focus is. Pressing a row picks it for a move: To when it is over, From when it is * not. *//** The scale's end: 150% of a budget. */export const MAX = 1.5;/** A share as a position on the track, in %. */export const x = (share: number) => (Math.min(Math.max(share, 0), MAX) / MAX) * 100;
budget-pacing.module.css
/* Copyright (c) 2026 Bruno Delorence. MIT License. *//* Budget pacing (budget-pacing.tsx): two cards stacked on a stage washed with soft gradients,   near-black and indigo by night, pale lavender by day. Each card is a header (an icon tile, a   title, a subtitle, a control at the end) over an inset panel; the Move card adds a footer.   The pacing chart (chart.tsx) lays every row on one grid: the team, the track, the share. The   guides (the zone past the budget, the Budget line, today's dotted line) and the axis sit over   the track column only, from the same widths, so they line up with every bar.   Colours are the tokens below, light-dark(light, dark) where the two differ: the component takes   the color-scheme it inherits from the page, or the one its colorScheme prop sets   (data-color-scheme). */.root {  --stage: #ebe9f5;  --wash-1: rgb(150 140 245 / 0.42);  --wash-2: rgb(196 180 252 / 0.5);  --wash-3: rgb(120 150 240 / 0.3);  --card: #ffffff;  --card-edge: rgb(20 20 40 / 0.07);  --panel: #f7f7f9;  --panel-edge: #ececf1;  --field: #ffffff;
data.ts
// Copyright (c) 2026 Bruno Delorence. MIT License./* * The budgets and the arithmetic of pacing: what each team has, has spent and will spend at its * current pace, by quarter or by month, and what a move between two teams does to both. */export type Tone = 'blue' | 'amber' | 'pink' | 'cyan' | 'violet' | 'grey' | 'green' | 'orange';export type Team = {  id: string;  name: string;  /** The colour of its bars and its letter. */  tone: Tone;  /** The quarter's budget, in dollars. */  budget: number;  /** Spent so far this quarter. */  spent: number;  /** What the quarter will have cost by its last day at the current pace. */  forecast: number;  /** The quarter's budget split over its three months, as shares that add up to 1. */  phasing: [number, number, number];  /** Spent so far this month, when the quarter is past its first month. */  monthSpent?: number;
menu.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import {  useEffect,  useLayoutEffect,  useRef,  useState,  type KeyboardEvent as ReactKeyboardEvent,  type ReactNode,} from 'react';import { Icon } from './glyphs';import styles from './budget-pacing.module.css';/* * The menus: placed on the stage under their trigger (over it when there is no room below), in * the stage's own px, since a gallery card may scale the whole stage. The arrows, Home and End * move between items; Escape closes and gives the focus back; a press elsewhere closes. */const ITEMS = '[role="menuitem"], [role="menuitemradio"]';export function Menu({
glyphs.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License./* The line icons: a 24-unit box, drawn with currentColor. */const PATHS = {  target:    'M12 20.5a8.5 8.5 0 1 0 0-17 8.5 8.5 0 0 0 0 17zM12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM12 12.6a.6.6 0 1 0 0-1.2.6.6 0 0 0 0 1.2z',  swap: 'M5 8.5h13.5M15 5l3.5 3.5L15 12M19 15.5H5.5M9 12l-3.5 3.5L9 19',  chevronDown: 'M7 10l5 5 5-5',  chevronRight: 'M10 7l5 5-5 5',  more: 'M6 12h.01M12 12h.01M18 12h.01',  check: 'M5 12.5l4.5 4.5L19 7.5',  spark: 'M12 4c.6 4.2 3.8 7.4 8 8-4.2.6-7.4 3.8-8 8-.6-4.2-3.8-7.4-8-8 4.2-.6 7.4-3.8 8-8z',  arrowRight: 'M5 12h13M13 7l5 5-5 5',  reset: 'M4.5 12a7.5 7.5 0 1 0 2.2-5.3M4.5 4.5v4h4',  copy: 'M8.5 8.5h11v11h-11zM15.5 8.5v-4h-11v11h4',  send: 'M20 4 9.5 14.5M20 4l-6.5 16-4-5.5L4 10.5z',} as const;export type IconName = keyof typeof PATHS;export function Icon({  name,  className,
demo-pointer.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import type { CSSProperties, Ref } from 'react';/* * The demo's pointer, and the steps that move it. A demo is a script of awaited steps: wait, or * glide the pointer somewhere. Stopping the demo (the reader takes over, or it scrolls away) ends * the step in progress at once: its promise rejects, which ends the script right there, and the * pointer fades out. * * Each glide is a curved flight played by the Web Animations API, so nothing runs frame by frame. * The points of the flight are handed to whoever wants to move along with it. The arrow and the * hand are HTML boxes * that swap by their visibility: a change of style inside an SVG would lay the SVG out again. */export type Point = { x: number; y: number };/** A glide's path and timing, for an animation that plays along with it. */export type Flight = { points: Point[]; timing: KeyframeAnimationOptions };export type Demo = {
use-autoplay.ts
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useCallback, useEffect, useRef, useState } from 'react';/* * When a demo may play on its own: while part of it is on screen and the tab is visible, never * under reduced motion, and never again once the reader has used it. `take()` hands it to the * reader for good, until the component mounts again (WCAG 2.2.2). */export function useAutoplay<T extends HTMLElement>() {  const ref = useRef<T>(null);  const [visible, setVisible] = useState(false);  const [reduced, setReduced] = useState(true);  const [taken, setTaken] = useState(false);  useEffect(() => {    const element = ref.current;    if (!element) return;    let onScreen = false;    const update = () => setVisible(onScreen && !document.hidden);    const observer = new IntersectionObserver(      ([entry]) => {