# Performance Table

> A wide analytics grid for campaign or product metrics: grouped two-tier headers, a pinned name column, expandable child rows and a sticky totals row. Jump-to pills and a draggable minimap scrub across column groups. Heatmap tints cells by how good they are, Compare shows change from the last period, and headers light their column.

- Slug: `performance-table`
- Category: [Tables](https://www.assembli.design/category/tables.md)
- Type: component
- Tags: table, analytics, data-grid, horizontal-scroll, pinned-columns, heatmap, totals, grouped-headers, expandable-rows, marketing
- npm dependencies: @base-ui/react, motion, lucide-react
- shadcn/ui dependencies: none
- Live preview: https://www.assembli.design/preview/performance-table
- Page: https://www.assembli.design/components/performance-table

![Performance Table preview](https://www.assembli.design/thumbnails/performance-table-light.png)

## Props

Other props pass through to the root element.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rows` (required) | `T[]` |  |  |
| `columns` (required) | `PerformanceColumn<T>[]` |  |  |
| `getChildren` | `(row: T) => T[] \| undefined` |  | Nested rows (ad sets under a campaign). They expand under their parent and aren't counted in totals. |
| `primary` (required) | `{ header: string; width?: number; cell: (row: T, ctx: { depth: number; query: s…` |  | The pinned first column. |
| `segments` | `PerformanceSegment<T>[]` | `[]` | Toggle chips that narrow the rows (channels, regions). |
| `periods` | `{ id: string; label: string }[]` | `[]` |  |
| `period` | `string` |  |  |
| `onPeriodChange` | `(id: string) => void` |  |  |
| `title` | `React.ReactNode` |  |  |
| `description` | `React.ReactNode` |  |  |
| `noun` | `{ one: string; many: string }` | `{ one: "row", many: "rows" }` |  |
| `defaultHeat` | `boolean` | `false` |  |
| `defaultCompare` | `boolean` | `false` |  |
| `maxHeight` | `number` | `540` | Height of the scrolling body in px. |

## Install

One-time setup (needs a subscription):

1. Add the registry to the project's `components.json`: `{"@assembli":{"url":"https://www.assembli.design/r/{name}.json","headers":{"Authorization":"Bearer ${ASSEMBLI_API_KEY}"}}}` (merge into `"registries"`).
2. Put an API key from https://www.assembli.design/account in `.env.local` as `ASSEMBLI_API_KEY=asm_…`.

Then install with the shadcn CLI (writes `components/performance-table/performance-table.tsx` and installs dependencies):

```bash
npx shadcn@latest add @assembli/performance-table
```

Registry item JSON: https://www.assembli.design/r/performance-table.json (send `Authorization: Bearer <api key>`)

## Code

> Component source needs an Assembli subscription ($12/month or $96/year) and an API key sent as `Authorization: Bearer <key>`. To get one without copying anything, POST https://www.assembli.design/api/agent/login (or call the MCP tool connect_account), show the user the link it returns, and poll https://www.assembli.design/api/agent/token for the key. Or subscribe at https://www.assembli.design/pricing and create a key at https://www.assembli.design/account.
