Getting Started

Installation

Install shadcn-table into a Base UI, Radix UI or React Aria shadcn/ui project with one shadcn CLI command, or hand the setup to your coding agent.

Ask your agentInstall shadcn-table in my app: https://www.shadcn-table.com/SKILL.md

Prerequisites

A shadcn/ui project on the Base UI, Radix UI or React Aria base, with React 19.2 or later and Tailwind CSS 4.3 or later. React Aria is supported since 0.5.0.

No project yet? Create one. Pick your base with the tabs: Base UI, Radix UI or React Aria. A React Aria project has an aria-* style in components.json (aria-nova is the style the React Aria copy is built on).

pnpm dlx shadcn@latest init --base base

Created with shadcn create

A project made with shadcn create needs no extra setup. The table renders through the shadcn/ui parts the project installs, so it follows the project's base, theme, base color, radius, menu accent and fonts.

  • Icon library: pick the project's icon library in the install command below. Each one installs its own edition of the table's icons.ts and only that icon package.
  • RTL: on a right-to-left page, set columnResizeDirection: 'rtl' on the table so column resizing follows the pointer.

Installation

Install

One command adds the table, the shadcn/ui components it uses and its npm packages. Pick your icon library: Lucide installs shadcn-table.json, Tabler shadcn-table-tabler.json, and the others their own shadcn-table-<library>.json. Turn on Short form to install by name, @shadcn-table/<item>, once the namespace is in components.json; registering it is optional.

pnpm dlx shadcn@latest add https://www.shadcn-table.com/r/base/shadcn-table.json

Verify

You should now see these files in your project:

components/ui/
├── shadcn-table/      ← new: the whole table library, yours to edit
│   ├── ShadcnTable.tsx
│   ├── index.ts
│   ├── types.ts
│   ├── components/
│   ├── features/
│   ├── hooks/
│   └── shared/
├── button.tsx         ← shadcn/ui components the table needs, added automatically
├── dialog.tsx
└── ...

Your global stylesheet is unchanged. The table's animations ship inside its components as a <style> tag that React hoists into <head>. Under a strict Content Security Policy, allow it with a nonce or style-src 'unsafe-inline'.

Known issue on React Aria

shadcn's aria-nova label part starts with an unused import * as React from "react". Vite's React template type-checks with noUnusedLocals, so a fresh shadcn init --template vite --base aria project reports TS6133 in components/ui/label.tsx. The file is your project's own after shadcn add: delete that import line, or set "noUnusedLocals": false in tsconfig.app.json. Not a shadcn-table defect.

Use it

Define columns, then pass them with your data to useShadcnTable.

import { useMemo } from 'react';
import {
  ShadcnTable,
  useShadcnTable,
  type ST_ColumnDef,
} from '@/components/ui/shadcn-table';

type Person = { name: string; age: number };

const data: Person[] = [
  { name: 'John', age: 30 },
  { name: 'Sara', age: 25 },
];

export function PeopleTable() {
  const columns = useMemo<ST_ColumnDef<Person>[]>(
    () => [
      { accessorKey: 'name', header: 'Name' },
      { accessorKey: 'age', header: 'Age' },
    ],
    [],
  );

  const table = useShadcnTable({ columns, data });

  return <ShadcnTable table={table} />;
}

Updating

Run the install command again with --overwrite. It replaces every file in components/ui/shadcn-table/, so commit or back up your local edits first.

pnpm dlx shadcn@latest add https://www.shadcn-table.com/r/base/shadcn-table.json --overwrite

To switch icon library, pick the new one above and run the command with --overwrite. It replaces icons.ts and adds the new icon package; the previous icon package stays in package.json, remove it by hand when nothing else uses it.

Uninstall

  1. Delete components/ui/shadcn-table/.
  2. Remove the npm packages if nothing else uses them: @tanstack/react-table, @tanstack/react-store, @tanstack/react-virtual, @tanstack/match-sorter-utils, highlight-words, and on React Aria react-aria-components (the shadcn/ui React Aria components use it too).

Nothing else to undo: the install never touches your global CSS.

The shadcn/ui components stay. Other parts of your app may use them.

On this page