# Usage dashboard

A shadcn/ui usage-based billing page: spend so far, a forecast against the budget, a running-total chart with a line per service, and plan limits in a table.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available for the docs, pricing and about pages: append `.md` to the URL or send an `Accept: text/markdown` header (the home page answers the header too). An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).

## At a glance

- **Good for:** Usage pages for cloud, API and AI products; Showing where this month's spend will land against a budget; A bill by service, with plan limits and overages; Admin dashboards with a sidebar and a usage area
- **Category:** Billing & payments › Usage, Dashboard & analytics · **Type:** Charts, Tables · **Style:** Motion, Minimal, Dark mode
- **See it:** [Live preview](https://www.craftui.space/docs/blocks/usage-dashboard) · [Screenshot](https://www.craftui.space/llms.md/preview/usage-dashboard.e18c4536.jpg)

![Usage dashboard](https://www.craftui.space/llms.md/preview/usage-dashboard.e18c4536.jpg)

## Install

```bash
pnpm dlx shadcn@latest add https://www.craftui.space/r/usage-dashboard.json
```

This is a paid item (BLK-Q9J3AK): the install needs a craftUI plan or a purchase of it. Signed in, the docs page gives your personal install command. Plans: https://www.craftui.space/pricing

## Usage

```tsx
import UsageDashboard from "@/components/blocks/usage-dashboard/usage-dashboard";

export default function Page() {
  return <UsageDashboard />;
}
```

With no props it renders with demo content; pass your own through the props below.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `shell` | `Partial<Omit<AppShellProps, "children">>` | — | The app around the page: brand, sidebar links, the person. |
| `services` | `UsageService[]` | `DEMO_SERVICES` | The services you bill for, up to 4, in the order they're listed. |
| `periods` | `UsagePeriod[]` | `DEMO_PERIODS` | Billing periods, newest first; the first one shows. |
| `className` | `string` | — | Height and placement of the app, e.g. "h-dvh" or "h-[46rem]". |

### `AppShellProps`

| Field | Type | Description |
| --- | --- | --- |
| `brand` (required) | `string` | Product name next to the monogram, e.g. "Acme". |
| `brandColor` (required) | `string` | Background of the brand monogram, any CSS colour. |
| `groups` (required) | `ShellGroup[]` | The sidebar's link groups. |
| `active` (required) | `string` | Id of the current sidebar link. |
| `trail` (required) | `string[]` | Where the page sits, e.g. ["Settings", "Billing"]. |
| `title` (required) | `string` | The page heading, e.g. "Billing". |
| `description` (required) | `string` | One line under the heading. |
| `actions` | `React.ReactNode` | Buttons at the right of the page header. |
| `user` (required) | `{ name: string; email: string }` | The signed-in person, shown at the foot of the sidebar. |
| `children` (required) | `React.ReactNode` | The page itself. |
| `className` | `string` | Height and placement, e.g. "h-dvh" (the default) or "h-[46rem]". |

### `UsageService`

| Field | Type | Description |
| --- | --- | --- |
| `id` (required) | `string` | Unique id; the key into each period's `services`. |
| `label` (required) | `string` | Name in the table and the chart readout, e.g. "Compute". |
| `unit` (required) | `string` | Short unit after the amount used, e.g. "vCPU-h" or "GB". |

### `UsagePeriod`

| Field | Type | Description |
| --- | --- | --- |
| `id` (required) | `string` | Unique id, e.g. "2026-11". |
| `label` (required) | `string` | Name in the period switch and the figures, e.g. "November". |
| `month` (required) | `string` | Short month for dates on the axis, e.g. "Nov". |
| `days` (required) | `number` | Days in the billing period. |
| `budget` (required) | `number` | Monthly budget, in dollars. |
| `services` (required) | `Record<string, ServiceUsage>` | Usage per service, keyed by service id. |

### `ShellGroup`

| Field | Type | Description |
| --- | --- | --- |
| `label` | `string` | Small heading above the group; leave out for none. |
| `items` (required) | `ShellLink[]` | The links in the group, in order. |

### `ServiceUsage`

| Field | Type | Description |
| --- | --- | --- |
| `daily` (required) | `number[]` | Spend per day, in dollars, from day 1 up to today. |
| `used` (required) | `number` | Usage so far, in the service's unit. |
| `included` (required) | `number` | What the plan includes, in the same unit. |

### `ShellLink`

| Field | Type | Description |
| --- | --- | --- |
| `id` (required) | `string` | Unique id; matched against `active` to mark the current page. |
| `label` (required) | `string` | Text in the sidebar, e.g. "Billing". |
| `icon` (required) | `IconSvgElement` | A Hugeicons icon from `@hugeicons/core-free-icons`. |

## Files

The install adds:

- `components/blocks/usage-dashboard/usage-dashboard.tsx`
- `components/blocks/usage-dashboard/usage-card.tsx`
- `components/blocks/usage-dashboard/spend-chart.tsx`
- `components/blocks/usage-dashboard/app-shell.tsx`
- `components/blocks/usage-dashboard/odometer.tsx`
- `components/blocks/usage-dashboard/ui.tsx`
- `components/blocks/usage-dashboard/usage-data.ts`
- `components/blocks/usage-dashboard/surface.ts`

npm dependencies (installed for you): `@hugeicons/core-free-icons`, `@hugeicons/react`, `motion`, `react-use-measure`.

shadcn/ui components it uses (the shadcn CLI adds any that are missing): `button`, `sheet`, `toggle-group`.