Data grid
ProA spreadsheet-style grid with editable cells and formulas.
pnpm dlx shadcn@latest add @caliper/data-gridChange a month and the totals follow. Select a block to see its sum below. Try typing =MAX(B2:D2) in a cell.
| Row | A | B | C | D | E | F | G |
|---|---|---|---|---|---|---|---|
| 1 | Budget line | January | February | March | Quarter | Share % | |
| 2 | Salaries | 84,000 | 84,000 | 86,500 | 254,500 | 63.28 | |
| 3 | Cloud hosting | 12,400 | 13,150 | 14,900 | 40,450 | ||
| 4 | Software licences | 6,200 | 6,200 | 6,900 | 19,300 | ||
| 5 | Marketing | 9,500 | 15,200 | 11,800 | 36,500 | ||
| 6 | Travel | 2,100 | 3,400 | 5,200 | 10,700 | ||
| 7 | Office | 4,300 | 4,300 | 4,300 | 12,900 | ||
| 8 | Contractors | 7,800 | 9,100 | 6,400 | 23,300 | ||
| 9 | Training | 800 | 1,500 | 2,200 | 4,500 | ||
| 10 | |||||||
| 11 | Total | 127,100 | 136,850 | 138,200 | 402,150 | ||
| 12 | Monthly average | 15,887.5 | 17,106.25 | 17,275 | 134,050 | ||
| 13 | |||||||
| 14 |
When to use #
Use it for
- Users enter and edit tabular numbers directly.
- Totals must update as cells change.
Skip it when
- Read-only data; use the data table.
Installation #
pnpm dlx shadcn@latest add @caliper/data-grid
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage #
Import it from your copy of the source. The example behind the preview comes with the source.
import { DataGrid } from "@/components/ui/data-grid"
The worked example comes with Pro
The 47-line example behind the preview opens here with a Pro or Team licence.
API reference #
DataGrid
component
Accessibility #
It exposes grid, gridcell and status semantics, with aria-label, aria-rowcount, aria-colcount, aria-multiselectable, aria-selected and aria-hidden kept in step with state. Changes that matter are announced through a live region.
Motion #
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.