gridcn2.0.0
Learning path

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. If components.json is 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.tsx starts with "use client".
  • In a Vite app, the @ alias in vite.config.ts and tsconfig.app.json matches components.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-onnpm packagesAlso installs
data-grid-toolbar@dnd-kit/dom, @dnd-kit/react, lucide-reactuse-debounce
data-grid-sort-list@dnd-kit/dom, @dnd-kit/react, lucide-reactNone
data-grid-context-menulucide-react, @base-ui/react, zustandNone
data-grid-comments@base-ui/react, zustandNone
data-grid-find-replacelucide-reactuse-debounce
data-grid-iohucre, papaparse, lucide-react, and the dev package @types/papaparsedropzone
data-grid-url-statenuqsdata-grid-pagination
data-grid-serverNonedata-grid-pagination
data-grid-paginationlucide-reactNone
data-grid-lookupNoneuse-debounce
data-grid-commentszustand, @base-ui/reactNone
data-grid-viewslucide-reactNone
data-grid-commentszustand, @base-ui/reactNone
data-grid-fill, data-grid-presence, data-grid-pinned-rowszustandNone
data-grid-history, data-grid-keybindings, data-grid-status-barNoneNone

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.

On this page