Installation
Install DataTable with the shadcn CLI, then add only the features you need.
Prerequisites
Section titled “Prerequisites”You need:
-
A React project (Next.js, Vite, etc.)
-
Shadcn UI set up in your project (Installation Guide). Radix UI (
new-york,radix-*), Base UI (base-*) and React Aria (aria-*, experimental) styles all work. -
TailwindCSS configured
-
TypeScript (recommended)
-
TanStack Table v9 (
@tanstack/react-table@^9). The CLI sets this version when you install registry items. To add it by hand, run:pnpm add @tanstack/react-table@^9
Radix UI and Base UI use the same source. React Aria has its own build (see below).
- Radix style:
"new-york"works. - Base UI style:
"base-nova"works. It is the currentshadcn initdefault. - Type errors after install?
- Update to a recent
shadcnCLI. - Re-add the block with
--overwrite.
- Update to a recent
- How it works: The source typechecks against both styles. The CLI swaps Radix idioms for Base UI ones during install (
asChildbecomesrender).
Configure the registry
Section titled “Configure the registry”Register the @niko-table/ namespace in your components.json so the shadcn CLI can find it. Add the registries field:
{ "$schema": "https://ui.shadcn.com/schema.json", // ... your existing config (style, tailwind, aliases, etc.) "registries": { "@niko-table": "https://niko-table.com/r/{style}/{name}.json" }}Tip: Don’t want to edit
components.json? Install by URL instead (see the URL commands below).
- These URLs install the Radix UI and Base UI version.
- On React Aria, put your style in the URL:
https://niko-table.com/r/aria-nova/<name>.json. Use thestylefrom yourcomponents.json.
Radix UI, Base UI and React Aria
Section titled “Radix UI, Base UI and React Aria”The same line works for all three. The CLI reads style in your components.json and gets the matching version.
- Radix UI (
new-york,radix-*) and Base UI (base-*): supported. - React Aria (
aria-*): new and experimental.- It needs the
registriesline above. Without it, the CLI uses the shadcn directory entry for@niko-table, which installs the Radix version. - Known gaps:
- Popovers, menus and the right-click menu are always modal: the page does not scroll while one is open.
- Arrow keys do not move between menu items and a search box or other controls inside the same menu. Tab and the mouse do.
- Right-click menus do not open with a long press on touch, and after one closes, focus goes to the page, not the row.
- Search in filters and menus matches text that contains what you type. It does not do fuzzy matches, and results keep their order.
- The first Escape in a search box clears it. The next one closes the popover.
- In the drag-to-reorder column menu, arrow keys do not move between rows. Tab, Enter and the mouse do.
- A picked date cannot be cleared by clicking it again, and a date range only reports once both ends are picked.
- Help icons with a tooltip are an extra Tab stop, and tooltips open on hover only after a first click on the page.
- shadcn’s React Aria
components/ui/label.tsximportsReactbut never uses it. That fails strict TypeScript (noUnusedLocals). Delete the import line. This is a shadcn issue, not Niko Table.
- It needs the
- Already using
https://niko-table.com/r/{name}.json? It still works on Radix and Base UI. Switch to the line above to get React Aria.
Installation
Section titled “Installation”Install in two steps, or all at once:
- Install the owner once.
@niko-table/data-tablecopiesDataTableRoot, the table chrome,data-table-coreanddata-table-uiinto your project. - Add features one by one. Run the CLI for each feature you need (pagination, search filter, DnD, etc.).
- Each add-on depends on
data-table-core. The CLI installs or reuses it. - It does not pull in Root or overwrite
table.tsx.
- Each add-on depends on
Install the owner now:
pnpm dlx shadcn@latest add @niko-table/data-tableRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add @tanstack/react-table@^9 lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
This installs the full table owner (data-table, data-table-core and data-table-ui).
- Includes
lib/data-table-features.ts. This is TanStack Table v9’s feature list.DataTableRootpasses it touseTable. - Trim it after install. Remove the features you never use. See Table Features.
- Need more? Add the optional blocks below one by one, or use Install Everything.
- Own the TanStack instance? Skip
data-tableand install the control items directly. See Components.
Install Everything
Section titled “Install Everything”Want every registry item at once? List them all. The shadcn CLI does not support wildcards like @niko-table/**. Installing only what you need is better (see Components).
pnpm dlx shadcn@latest add @niko-table/data-table @niko-table/data-table-virtualized @niko-table/data-table-pagination @niko-table/data-table-search-filter @niko-table/data-table-sort-menu @niko-table/data-table-view-menu @niko-table/data-table-view-dnd-menu @niko-table/data-table-clear-filter @niko-table/data-table-filter-menu @niko-table/data-table-faceted-filter @niko-table/data-table-inline-filter @niko-table/data-table-slider-filter @niko-table/data-table-date-filter @niko-table/data-table-export-button @niko-table/data-table-aside @niko-table/data-table-selection-bar @niko-table/data-table-column-sort @niko-table/data-table-column-hide @niko-table/data-table-column-pin @niko-table/data-table-column-group @niko-table/data-table-column-resize @niko-table/data-table-column-auto-fit @niko-table/data-table-column-sizing-persistence @niko-table/data-table-column-faceted-filter @niko-table/data-table-column-slider-filter @niko-table/data-table-column-date-filter @niko-table/data-table-row-dnd @niko-table/data-table-column-dnd @niko-table/data-table-virtualized-row-dnd @niko-table/data-table-virtualized-column-dnd @niko-table/data-table-grid @niko-table/data-table-grid-changesTo browse the registry, run:
npx shadcn@latest search @niko-tableInstall everything (via URLs)
Section titled “Install everything (via URLs)”Skip the registry setup by passing full URLs. On React Aria, replace /r/ with /r/<your style>/ in each URL (for example /r/aria-nova/data-table.json):
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table.json" "https://niko-table.com/r/data-table-virtualized.json" "https://niko-table.com/r/data-table-pagination.json" "https://niko-table.com/r/data-table-search-filter.json" "https://niko-table.com/r/data-table-sort-menu.json" "https://niko-table.com/r/data-table-view-menu.json" "https://niko-table.com/r/data-table-view-dnd-menu.json" "https://niko-table.com/r/data-table-clear-filter.json" "https://niko-table.com/r/data-table-filter-menu.json" "https://niko-table.com/r/data-table-faceted-filter.json" "https://niko-table.com/r/data-table-inline-filter.json" "https://niko-table.com/r/data-table-slider-filter.json" "https://niko-table.com/r/data-table-date-filter.json" "https://niko-table.com/r/data-table-export-button.json" "https://niko-table.com/r/data-table-aside.json" "https://niko-table.com/r/data-table-selection-bar.json" "https://niko-table.com/r/data-table-column-sort.json" "https://niko-table.com/r/data-table-column-hide.json" "https://niko-table.com/r/data-table-column-pin.json" "https://niko-table.com/r/data-table-column-group.json" "https://niko-table.com/r/data-table-column-resize.json" "https://niko-table.com/r/data-table-column-auto-fit.json" "https://niko-table.com/r/data-table-column-sizing-persistence.json" "https://niko-table.com/r/data-table-column-faceted-filter.json" "https://niko-table.com/r/data-table-column-slider-filter.json" "https://niko-table.com/r/data-table-column-date-filter.json" "https://niko-table.com/r/data-table-row-dnd.json" "https://niko-table.com/r/data-table-column-dnd.json" "https://niko-table.com/r/data-table-virtualized-row-dnd.json" "https://niko-table.com/r/data-table-virtualized-column-dnd.json" "https://niko-table.com/r/data-table-grid.json" "https://niko-table.com/r/data-table-grid-changes.json"Optional Components
Section titled “Optional Components”Add only what you need. Each component installs on its own:
Table Controls
Section titled “Table Controls”DataTablePagination:
pnpm dlx shadcn@latest add @niko-table/data-table-paginationRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-pagination.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-pagination.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableSearchFilter:
pnpm dlx shadcn@latest add @niko-table/data-table-search-filterRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-search-filter.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-search-filter.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableSortMenu:
pnpm dlx shadcn@latest add @niko-table/data-table-sort-menuRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-sort-menu.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-sort-menu.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-react @dnd-kit/core @dnd-kit/modifiers @dnd-kit/sortable @dnd-kit/utilitiesCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableViewMenu:
pnpm dlx shadcn@latest add @niko-table/data-table-view-menuRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-view-menu.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-view-menu.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableViewDndMenu (column visibility and drag-to-reorder):
pnpm dlx shadcn@latest add @niko-table/data-table-view-dnd-menuRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-view-dnd-menu.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-view-dnd-menu.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add @dnd-kit/core @dnd-kit/modifiers @dnd-kit/sortable @dnd-kit/utilities lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableClearFilter:
pnpm dlx shadcn@latest add @niko-table/data-table-clear-filterRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-clear-filter.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-clear-filter.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableExportButton:
pnpm dlx shadcn@latest add @niko-table/data-table-export-buttonRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-export-button.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-export-button.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
Filter Components
Section titled “Filter Components”DataTableFilterMenu:
pnpm dlx shadcn@latest add @niko-table/data-table-filter-menuRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-filter-menu.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-filter-menu.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableFacetedFilter:
pnpm dlx shadcn@latest add @niko-table/data-table-faceted-filterRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-faceted-filter.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-faceted-filter.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableInlineFilter:
pnpm dlx shadcn@latest add @niko-table/data-table-inline-filterRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-inline-filter.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-inline-filter.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-react react-day-pickerCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableSliderFilter:
pnpm dlx shadcn@latest add @niko-table/data-table-slider-filterRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-slider-filter.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-slider-filter.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableDateFilter:
pnpm dlx shadcn@latest add @niko-table/data-table-date-filterRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-date-filter.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-date-filter.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-react react-day-pickerCopy and paste the following code into your project.
Update the import paths to match your project setup.
Column Header Components
Section titled “Column Header Components”DataTableColumnSort:
pnpm dlx shadcn@latest add @niko-table/data-table-column-sortRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-sort.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-sort.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableColumnHide:
pnpm dlx shadcn@latest add @niko-table/data-table-column-hideRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-hide.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-hide.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableColumnPin:
pnpm dlx shadcn@latest add @niko-table/data-table-column-pinRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-pin.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-pin.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableColumnGroup:
pnpm dlx shadcn@latest add @niko-table/data-table-column-groupRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-group.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-group.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableColumnResize:
pnpm dlx shadcn@latest add @niko-table/data-table-column-resizeRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-resize.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-resize.json (use the style from your components.json).
This component relies on other items which must be installed first.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableColumnAutoFit:
pnpm dlx shadcn@latest add @niko-table/data-table-column-auto-fitRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-auto-fit.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-auto-fit.json (use the style from your components.json).
This component relies on other items which must be installed first.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
useColumnSizingPersistence (persist column widths):
pnpm dlx shadcn@latest add @niko-table/data-table-column-sizing-persistenceRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-sizing-persistence.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-sizing-persistence.json (use the style from your components.json).
This component relies on other items which must be installed first.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableColumnFacetedFilter:
pnpm dlx shadcn@latest add @niko-table/data-table-column-faceted-filterRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-faceted-filter.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-faceted-filter.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableColumnSliderFilter:
pnpm dlx shadcn@latest add @niko-table/data-table-column-slider-filterRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-slider-filter.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-slider-filter.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableColumnDateFilter:
pnpm dlx shadcn@latest add @niko-table/data-table-column-date-filterRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-date-filter.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-date-filter.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-react react-day-pickerCopy and paste the following code into your project.
Update the import paths to match your project setup.
Layout Components
Section titled “Layout Components”DataTableVirtualized:
pnpm dlx shadcn@latest add @niko-table/data-table-virtualizedRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-virtualized.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-virtualized.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add @tanstack/react-virtualCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataGrid (editable spreadsheet):
Turns the virtualized table into an editable grid with keyboard navigation and clipboard support. See the Niko Grid docs.
pnpm dlx shadcn@latest add @niko-table/data-table-gridRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-grid.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-grid.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
Optional change tracking for saves (useGridChanges):
pnpm dlx shadcn@latest add @niko-table/data-table-grid-changesRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-grid-changes.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-grid-changes.json (use the style from your components.json).
This component relies on other items which must be installed first.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableAside:
pnpm dlx shadcn@latest add @niko-table/data-table-asideRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-aside.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-aside.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableSelectionBar:
pnpm dlx shadcn@latest add @niko-table/data-table-selection-barRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-selection-bar.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-selection-bar.json (use the style from your components.json).
This component relies on other items which must be installed first.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
Drag and Drop
Section titled “Drag and Drop”DataTableRowDnd:
pnpm dlx shadcn@latest add @niko-table/data-table-row-dndRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-row-dnd.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-row-dnd.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add @dnd-kit/core @dnd-kit/modifiers @dnd-kit/sortable @dnd-kit/utilities lucide-reactCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableColumnDnd:
pnpm dlx shadcn@latest add @niko-table/data-table-column-dndRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-column-dnd.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-column-dnd.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add @dnd-kit/core @dnd-kit/modifiers @dnd-kit/sortable @dnd-kit/utilitiesCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableVirtualizedRowDnd (needs virtualized + row-dnd):
pnpm dlx shadcn@latest add @niko-table/data-table-virtualized-row-dndRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-virtualized-row-dnd.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-virtualized-row-dnd.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add @tanstack/react-virtual @dnd-kit/sortable @dnd-kit/utilitiesCopy and paste the following code into your project.
Update the import paths to match your project setup.
DataTableVirtualizedColumnDnd (needs virtualized + column-dnd):
pnpm dlx shadcn@latest add @niko-table/data-table-virtualized-column-dndRequires the @niko-table registry in your components.json. See the Installation Guide for setup. Or install directly via URL:
pnpm dlx shadcn@latest add "https://niko-table.com/r/data-table-virtualized-column-dnd.json"On React Aria, put your style in the URL: https://niko-table.com/r/aria-nova/data-table-virtualized-column-dnd.json (use the style from your components.json).
This component relies on other items which must be installed first.
Install the following dependencies.
pnpm add @tanstack/react-virtual @dnd-kit/sortable @dnd-kit/utilitiesCopy and paste the following code into your project.
Update the import paths to match your project setup.
- Do not combine Row DnD with sorting or filtering.
- Column DnD is safe with any feature.
- Row and column packages are separate. Installing one does not copy the other.
Architecture Note
Section titled “Architecture Note”DataTable has two layers:
- Components (
data-table-*.tsxin/components): wrappers that get the table fromDataTableRootcontext throughuseDataTable(). You do not pass props down. This is the recommended layer.- Examples:
DataTableSearchFilter,DataTableFilterMenu,DataTableSortMenu,DataTablePagination.
- Examples:
- Filters (
table-*.tsxin/filters): the core pieces. They take atableprop and read the TanStack Table instance (liketable.stateandtable.setGlobalFilter()). You can use them on their own.- Examples:
TableSearchFilter,TableFilterMenu,TableSortMenu.
- Examples:
Why two layers?
DataTable*components: import from their direct paths (e.g.@/components/niko-table/components/data-table-pagination). They work with no setup.Table*filters: import from filters (e.g.@/components/niko-table/filters/table-pagination). Use them to build your own components or manage the table instance yourself.- Your control: all filter components use TanStack Table hooks directly.
Learn more in the Introduction.
Custom Table Component
Section titled “Custom Table Component”@niko-table/data-table pulls in @niko-table/data-table-ui. That installs a custom components/ui/table.tsx, which adds these to the default Shadcn table:
TableComponentexport. A plain<table>without the scroll wrapper. DataTable uses it internally.data-slotattributes on all elements.- A focusable scroll container (
tabIndex={0}). Keyboard users can focus it and scroll with the arrow keys (WCAG 2.1.1).
Controls that only depend on data-table-core do not install this file. Your customized table.tsx is safe.
- Want our version? Install
@niko-table/data-table-uiyourself. - Want to keep yours? That works if it exports
TableComponent.
Note: Our
table.tsxis 100% backward compatible with existing Shadcn tables. If you already have atable.tsxand installdata-tableordata-table-ui, the CLI asks before overwriting.
Monorepo / Non-Standard Layouts
Section titled “Monorepo / Non-Standard Layouts”If your UI components live in a non-standard path (e.g., packages/ui/src/components/ instead of src/components/ui/), the shadcn CLI may put table.tsx in the wrong place. This is a known shadcn CLI quirk with registry:ui paths.
Workaround:
- After installing, check where
table.tsxlanded. - If it is in a nested
ui/folder, move it to your real UI components path. - Make sure it exports
TableComponent:
// Your existing table.tsx — add this function and exportfunction TableComponent({ className, ...props}: React.ComponentProps<"table">) { return ( <table data-slot="table" className={cn("w-full caption-bottom text-sm", className)} {...props} /> )}
// Add TableComponent to your existing exportsexport { TableComponent, Table, TableHeader, // ... your other exports}Manual Installation
Section titled “Manual Installation”Prefer to copy the files by hand? See the Manual Installation Guide. It has every component file in one place.
Your First Table
Section titled “Your First Table”Build a simple table first. Add features later.
-
Start by defining your data
This data is a list of users with names and emails.
components/example-table.tsx type User = {id: stringname: stringemail: stringstatus: "active" | "inactive"}const data: User[] = [] -
Define your columns
Columns say how each field is shown.
components/example-table.tsx import type { DataTableColumnDef } from "@/components/niko-table/types"const columns: DataTableColumnDef<User>[] = [{accessorKey: "name",header: "Name",},{accessorKey: "email",header: "Email",},{accessorKey: "status",header: "Status",cell: ({ row }) => (<spanclassName={row.original.status === "active"? "text-success": "text-muted-foreground"}>{row.original.status}</span>),},] -
Build your table
Put the table together with DataTable components.
components/example-table.tsx import { DataTableRoot } from "@/components/niko-table/core/data-table-root"import { DataTable } from "@/components/niko-table/core/data-table"import {DataTableHeader,DataTableBody,} from "@/components/niko-table/core/data-table-structure"export function ExampleTable() {return (<DataTableRoot data={data} columns={columns}><DataTable><DataTableHeader /><DataTableBody /></DataTable></DataTableRoot>)}
Dependencies by Example
Section titled “Dependencies by Example”Each example needs different dependencies. Here is the list:
Simple Table
Section titled “Simple Table”@tanstack/react-table@^9- Shadcn:
table
Basic Table
Section titled “Basic Table”@tanstack/react-table@^9- Shadcn:
table,button,dropdown-menu
Search Table
Section titled “Search Table”@tanstack/react-table@^9- Shadcn:
table,button,input,dropdown-menu
Faceted Filter Table
Section titled “Faceted Filter Table”@tanstack/react-table@^9- Shadcn:
table,button,input,dropdown-menu,popover,command,checkbox,select
Row Selection Table
Section titled “Row Selection Table”@tanstack/react-table@^9- Shadcn:
table,button,checkbox,dropdown-menu
Row Expansion Table
Section titled “Row Expansion Table”@tanstack/react-table@^9- Shadcn:
table,button,input,dropdown-menu
Tree Table
Section titled “Tree Table”@tanstack/react-table@^9- Shadcn:
table,button,input,dropdown-menu
Grouping Table
Section titled “Grouping Table”@tanstack/react-table@^9- Shadcn:
table,button,input,dropdown-menu - Registry:
@niko-table/data-table-column-group
Virtualization Table
Section titled “Virtualization Table”@tanstack/react-table@^9@tanstack/react-virtual- Shadcn:
table,button,input,dropdown-menu,scroll-area
Advanced Table (All Features)
Section titled “Advanced Table (All Features)”@tanstack/react-table@^9- Shadcn:
table,button,input,dropdown-menu,popover,command,checkbox,select,scroll-area,separator,skeleton,tooltip - Inline Filters: included in DataTable components (no extra dependencies)
- Sortable Rows (optional):
@niko-table/data-table-row-dnd. It installs its@dnd-kitdependencies for you (built on DiceUI Sortable patterns).
Advanced Table with URL State (nuqs)
Section titled “Advanced Table with URL State (nuqs)”@tanstack/react-table@^9nuqs(nuqs.dev): type-safe URL state- Shadcn: All components from Advanced Table
- Inline Filters: included in DataTable components (no extra dependencies)
- Sortable Rows (optional):
@niko-table/data-table-row-dnd. It installs its@dnd-kitdependencies for you (built on DiceUI Sortable patterns).
Optional Dependencies
Section titled “Optional Dependencies”Some features need extra dependencies:
URL State Management (nuqs)
Section titled “URL State Management (nuqs)”To keep table state in the URL, install nuqs:
npm install nuqsnuqs keeps filters, pagination and sorting in sync with the URL.
Sortable/Draggable Rows
Section titled “Sortable/Draggable Rows”For drag-and-drop row reordering, install the registry block. It brings its @dnd-kit dependencies:
pnpm dlx shadcn@latest add @niko-table/data-table-row-dndSee the Row DnD Table example. The sortable parts follow DiceUI Sortable patterns.
Project Structure
Section titled “Project Structure”After install, your project looks like this:
src/├── components/│ ├── ui/ # Shadcn UI components│ └── niko-table/ # DataTable components│ ├── core/│ ├── types/│ ├── hooks/│ ├── components/│ ├── filters/│ ├── config/│ └── lib/└── lib/ └── utils.tsVerify Installation
Section titled “Verify Installation”Render a small table to check that it works:
import { DataTableRoot } from "@/components/niko-table/core/data-table-root"import { DataTable } from "@/components/niko-table/core/data-table"import { DataTableHeader, DataTableBody,} from "@/components/niko-table/core/data-table-structure"
const columns = [ { accessorKey: "name", header: "Name" }, { accessorKey: "email", header: "Email" },]
const data = []
export function TestTable() { return ( <DataTableRoot data={data} columns={columns}> <DataTable> <DataTableHeader /> <DataTableBody /> </DataTable> </DataTableRoot> )}Next Steps
Section titled “Next Steps”DataTable is installed. Try the examples:
- Simple Table - Basic table, no pagination
- Basic Table - Add pagination and sorting
- Search Table - Add search
- Faceted Filter Table - Add column filters
- Advanced Table - All features together