# Pace

> A goal for the month and whether you will make it: the running total climbs toward a goal line, the rest of the month is drawn at this pace, and the verdict says when.

A goal card usually shows a progress bar at 62% and leaves you to work out whether 62% on the 18th is good. Pace answers it. Every day of the month is a column of hairlines, faint until it is filled. The days so far rise to the running total, one after another. Then the rest of the month draws in ahead of today in finer lines, where the current pace takes you. Last, from the day that pace crosses the goal, the lines above the goal line light green, day after day, and the verdict comes in: on pace to reach it on the 26th, reached on the 21st, or short by $4.2k. Point at a day so far for what it added and the total by then; point at a day ahead for where you will be by then at this rate. A new target glides the goal line to its place and the verdict changes with it.

## Install

```bash
npx shadcn@latest add https://hairlineui.com/r/pace.json
```

Needs React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.

- npm: none
- Hairline UI components it needs (the CLI installs them too): `number-roll`
- Docs and live preview: https://hairlineui.com/ui/pace
- Registry item (source): https://hairlineui.com/r/pace.json

## Usage

```tsx
import { Pace } from "@/components/pace";

<Pace
  title="New revenue in November"
  period="November"
  target={42000}
  days={november} // [{ key: "2026-11-01", label: "Sun 1 Nov", tick: "1", value: 820 }, …, { key: "2026-11-30", label: "Mon 30 Nov", tick: "30" }]
  format={{ style: "currency", currency: "USD", maximumFractionDigits: 0 }}
/>
```

## From your database

Sum by day on the server for the days so far and list every day of the month, leaving out the value for the days still to come.

```tsx
import { Pace, type PaceDay } from "@/components/pace";
import { db } from "@/lib/db";

export async function MonthGoal() {
  const now = new Date();
  const first = new Date(now.getFullYear(), now.getMonth(), 1);
  const length = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate();
  const sums = new Map((await db.revenueByDay({ from: first, to: now })).map((r) => [r.day, r.total]));
  const days: PaceDay[] = Array.from({ length }, (_, i) => {
    const date = new Date(first.getFullYear(), first.getMonth(), i + 1);
    const key = date.toISOString().slice(0, 10);
    return {
      key,
      label: date.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }),
      tick: String(i + 1),
      value: date <= now ? (sums.get(key) ?? 0) : undefined,
    };
  });
  return <Pace title="New revenue this month" target={42000} days={days} format={{ style: "currency", currency: "USD" }} />;
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `days` | `PaceDay[]` | – | Every day of the period in order: key, label, an optional tick, and value for the days so far. |
| `target` | `number` | – | The goal for the period. |
| `title` | `string` | `"Revenue this month"` | Above the total. |
| `period` | `string` | `"the month"` | Names the period for screen readers, e.g. "November". |
| `format / locales` | `Intl.NumberFormatOptions / string` | – | How the figures read; the goal and forecasts use the same, compact. |
| `color` | `string` | `var(--chart-1)` | Any CSS colour for the columns. |

## States

- **arrive**: Three beats: the days so far rise to the running total one after another (620ms each, up to 28ms apart); then the days ahead draw in, in finer lines, at this pace; last, the green above the goal line spreads from the crossing day and the verdict fades in.
- **point**: The day under the pointer stays bright and its neighbours fall away with distance (240ms). The readout glides over it with what the day added and the total so far, or where this pace takes you by then.
- **goal**: A new target moves the goal line on a 620ms ease and the verdict changes in place: on pace (green), reached (green) or short by an amount (amber).
- **reduced motion**: No rising or staging: the month and the verdict are drawn at once.

## What it handles

A progress bar says how far you are, not whether that is enough for the day of the month it is. People end up doing run-rate sums in their heads.

- **The question answered**: The verdict says whether this pace reaches the goal, on which day, or by how much it falls short.
- **The month at a glance**: Days so far are filled columns, days ahead are finer lines at this pace, today a hairline between them.
- **Read any day**: A day so far shows what it added and the total by then; a day ahead shows where this pace takes you.
- **Over the goal, made visible**: From the day the total crosses the goal, the lines above the goal line light green.
- **Your data, your format**: Pass the days of any period with values for the ones so far, a target and an Intl number format.
- **Keyboard and screen readers**: Arrow keys read each day aloud; the verdict and every day are in a hidden table.

## Replaces

a goal progress bar, a run-rate forecast, a cumulative line chart, a target line, a chart library

## Where it fits

- **Revenue and MRR goals**: New revenue against this month's target, with the day you will hit it.
- **Sales quotas**: A rep's or a team's bookings against quota, a month or a quarter at a time.
- **Growth targets**: Signups, trials or activations against the month's goal.
- **Fundraising and campaigns**: Money raised against the goal, and whether the campaign gets there by its end.

## Notes

- The plot is one tab stop: arrow keys, Home and End move between days and the readout is announced politely; Escape hides it.
- Every day's figure, the totals and the verdict are in a visually hidden table.
- Green and amber only carry the verdict, which is always written out in words too.
- Columns are masked stacks of hairlines (2px for days so far, 1px for the projection), sized once; only opacity changes on hover.
- Installs Number roll. With reduced motion everything is drawn at once.

License: MIT (https://hairlineui.com/license#components)
