Install gridcn
Step 1 of 8
Check the prerequisites, install the core grid with the shadcn CLI, and add the optional pieces you need.
This step copies the gridcn source into your project. gridcn has no npm package. The shadcn CLI reads the @gridcn registry and writes the files, and the files belong to you.
Check the prerequisites
Your project needs these before you install:
- React 19 and Tailwind CSS 4.
- shadcn/ui, set up with
npx shadcn init. Ifcomponents.jsonis missing, run that command first. The CLI reads the file to place the gridcn files. - In the Next.js App Router, a client component that renders the grid. The next steps do this, because
data-grid.tsxstarts with"use client". - In a Vite app, the
@alias invite.config.tsandtsconfig.app.jsonmatchescomponents.json. See Fix imports that do not resolve. - Node.js and TypeScript versions that meet the framework floors.
Install the core grid
The core is the data-grid item. It holds the grid, the built-in cell types, selection, the cell editors, and the clipboard. The CLI resolves the @gridcn registry from the hosted site, so there is no setup step:
pnpm dlx shadcn@latest add @gridcn/data-grid
The command installs these npm packages: zustand, use-sync-external-store, lucide-react, and @base-ui/react. It also adds the shadcn/ui components that the grid uses, such as button, popover, and tooltip.
The files land in components/data-grid/. Import from the barrel file data-grid.tsx:
import { DataGrid, defineColumns } from "@/components/data-grid/data-grid";Result: components/data-grid/data-grid.tsx exists in your project.
Add optional pieces
An add-on is an optional item with its own folder, such as components/data-grid-history/. Every add-on installs the core with it. Check the add-ons you want and the command joins them:
pnpm dlx shadcn@latest add @gridcn/data-grid-toolbar @gridcn/data-grid-history
The learning path uses the toolbar and undo and redo. The CLI also installs the npm packages and the other gridcn items that an add-on needs. Each add-on adds the shadcn/ui components it uses.
The table lists the npm packages and the items that each add-on installs:
| Add-on | npm packages | Also installs |
|---|---|---|
data-grid-toolbar | @dnd-kit/dom, @dnd-kit/react, lucide-react | use-debounce |
data-grid-sort-list | @dnd-kit/dom, @dnd-kit/react, lucide-react | None |
data-grid-context-menu | lucide-react, @base-ui/react, zustand | None |
data-grid-comments | @base-ui/react, zustand | None |
data-grid-find-replace | lucide-react | use-debounce |
data-grid-io | hucre, papaparse, lucide-react, and the dev package @types/papaparse | dropzone |
data-grid-url-state | nuqs | data-grid-pagination |
data-grid-server | None | data-grid-pagination |
data-grid-pagination | lucide-react | None |
data-grid-lookup | None | use-debounce |
data-grid-comments | zustand, @base-ui/react | None |
data-grid-views | lucide-react | None |
data-grid-comments | zustand, @base-ui/react | None |
data-grid-fill, data-grid-presence, data-grid-pinned-rows | zustand | None |
data-grid-history, data-grid-keybindings, data-grid-status-bar | None | None |
To pin a release, see Pin a release. If an install fails or the grid renders without styles, see Fix install problems.
Next: Render your first grid.