# KPI Tile

> A dashboard stat with its change and a sparkline you can scrub, rolling the number to any day.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Components › Stats |
| Live preview | https://uibrik.com/components/kpi-tile |
| Writes | 1 files into `components/uibrik/kpi-tile/`, plus `components/uibrik/_charts/chart-kit.tsx` |
| Packages | `@number-flow/react`, `@tabler/icons-react`, `motion`, `react-use-measure` (the CLI installs them) |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 9, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/kpi-tile.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/kpi-tile`.

Can't run commands? https://uibrik.com/components/kpi-tile/prompt.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { KpiTile } from "@/components/uibrik/kpi-tile/kpi-tile";

const format = { style: "currency", currency: "USD", maximumFractionDigits: 0 };

<KpiTile
  title="Revenue"
  deltaLabel="vs last month"
  invert={false}
  area
  accent=""
  format={format}
  // data={[{ label: "…", value: 0 }]}
  // value={0}
  // delta={0}
/>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/kpi-tile.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `title` | `string` | `"Revenue"` | Names the metric. |
| `deltaLabel` | `string` | `"vs last month"` | What the change is measured against. |
| `invert` | `boolean` | `false` | Lower is better (churn, latency, cost), so a fall reads as good. |
| `area` | `boolean` | `true` | Wash under the line. |
| `accent` | `string` | `""` | Line colour. Empty uses the chart palette. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `data` | `{ label: string; value: number }[]` |  | One point per period, oldest first. The last point is the current value. |
| `value` | `number` |  | Headline value. Defaults to the last point. |
| `delta` | `number` |  | Change as a fraction (0.124 is +12.4%). Defaults to the last point against the first. |
| `format` | `Intl.NumberFormatOptions` | `USD currency` | Formats every number, e.g. { style: "percent" }. |
| `className` | `string` |  | Classes for the outer shell. |

## Where it fits

- **Dashboard headline metrics**: A stat with its change and a sparkline gives the key number and its trend together. Pairs with [Area Chart](https://uibrik.com/components/area-chart.md).
- **Revenue and growth summaries**: Scrubbing the sparkline rolls the number to any day, answering "what was it last Tuesday". Pairs with [Revenue Dashboard](https://uibrik.com/components/revenue-dashboard.md) (Pro).
- **Admin home pages**: A row of tiles is the quickest way to show the health of a product.

## Same shelf: Stats

- [Streak Calendar](https://uibrik.com/components/streak-calendar.md) (Pro): An activity heatmap whose days lift under the pointer or arrow keys, with a tooltip that glides between them, a today cell that fills when logged, and a beat for a new record.
- [Uptime Bar](https://uibrik.com/components/uptime-bar.md) (Pro): A status page history with a tick for every day, lifting any day to show what happened.
- [Gauge](https://uibrik.com/components/gauge.md) (Pro): A calm meter for one value against its range, coloured by the zone it's in and telling you how far it is to the next.
- [Gauge Dial](https://uibrik.com/components/gauge-dial.md): A 240-degree dial whose gradient arc fills behind a spring-driven knob, with lit ticks and a zone badge; drag it or use the arrow keys.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/kpi-tile/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
