Manual Installation
Copy and paste all DataTable components into your project manually.
Prerequisites
Section titled βPrerequisitesβBefore copying the components, make sure you have:
- A React project (Next.js, Vite, etc.)
- Shadcn UI set up in your project (Installation Guide)
- TailwindCSS configured
- TypeScript (recommended)
Using the Base UI generation (
"style": "base-nova")? Prefer the CLI install β the shadcn CLI adapts the source to Base UI idioms (asChildβrender) at install time. The raw files copied on this page target the Radix (new-york) generation.
Architecture Note
Section titled βArchitecture NoteβThe DataTable components use a two-layer architecture for maximum flexibility:
- Components (
data-table-*.tsxin/componentsfolder) - Context-aware wrapper components that useuseDataTable()hook to automatically get the table fromDataTableRootcontext. These eliminate prop drilling and are the recommended way to use components:DataTableSearchFilter,DataTableFilterMenu,DataTableSortMenu,DataTablePagination, etc.
- Filters (
table-*.tsxin/filtersfolder) - Core implementation components that accept atableprop directly and read from the TanStack Table instance (liketable.state,table.setGlobalFilter(), etc.). These can be used standalone:TableSearchFilter,TableFilterMenu,TableSortMenu, etc.
Why this architecture?
- Use
DataTable*components from their direct paths (e.g.@/components/niko-table/components/data-table-pagination) when you want context-based, zero-config usage - Use
Table*components from filters (e.g.@/components/niko-table/filters/table-pagination) when you want to build custom components or manage the table instance yourself - All filter components use TanStack Table hooks directly, giving you full control
Installation Steps
Section titled βInstallation Stepsβ-
Install the required dependencies
This registry targets TanStack Table v9:
You also need
lib/data-table-features.tsfrom the files below β that is thetableFeatures()registrationDataTableRootpasses touseTable. See Table Features. -
Install the required Shadcn UI components
The registry handles most Shadcn dependencies automatically, but for manual installation you need:
-
Copy the custom table component
The DataTable requires a custom
components/ui/table.tsxwith aTableComponentexport. Copy it from the manual installation files below, or install it via the registry CLI (see the Installation Guide). -
Copy all DataTable components
Copy all the files below into your project, maintaining the directory structure shown.
-
Update import paths
Update the import paths in the copied files to match your project structure. The components use:
@/components/ui/for Shadcn UI components@/components/niko-table/for DataTable components@/lib/for utility functions
Ensure your project has the
@/path alias pointing at yoursrc/directory (or replace@/with your own alias in the copied code). Use direct file imports only (no barrel exports): import from the specific file (e.g.@/components/niko-table/core/data-table-root,@/components/niko-table/lib/constants) so bundlers can tree-shake. This matches the shadcn pattern of one entry point per component. -
Verify installation
Create a simple test to verify everything is working:
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>)}
Project Structure
Section titled βProject StructureβAfter copying all files, your project structure should look like this:
your-project/βββ src/β βββ components/β β βββ ui/β β β βββ table.tsx # Updated Shadcn table componentβ β β βββ button.tsxβ β β βββ input.tsxβ β β βββ dropdown-menu.tsxβ β β βββ ... # Other Shadcn componentsβ β ββ β βββ niko-table/β β ββ β βββ core/ # Core table componentsβ β β βββ data-table.tsx # Container + scroll wrapperβ β β βββ data-table-root.tsx # Top-level provider + table optionsβ β β βββ data-table-context.tsx # useDataTable() contextβ β β βββ data-table-error-boundary.tsx # Error boundary wrapperβ β β βββ data-table-structure.tsx # Header, Body, EmptyBody, Skeleton, Loading, LoadingMoreβ β β βββ data-table-row-dnd-structure.tsx # Row DnD bodyβ β β βββ data-table-column-dnd-structure.tsx # Column DnD header/bodyβ β β βββ data-table-virtualized-structure.tsx # VirtualizedHeader, VirtualizedBody, VirtualizedEmptyBody, VirtualizedSkeleton, VirtualizedLoading, VirtualizedLoadingMoreβ β β βββ data-table-virtualized-row-dnd-structure.tsx # Virtualized row DnD bodyβ β β βββ data-table-virtualized-column-dnd-structure.tsx # Virtualized column DnD header/bodyβ β ββ β βββ components/ # Context-aware user-facing componentsβ β β βββ data-table-search-filter.tsxβ β β βββ data-table-view-menu.tsxβ β β βββ data-table-view-dnd-menu.tsxβ β β βββ data-table-filter-menu.tsxβ β β βββ data-table-sort-menu.tsxβ β β βββ data-table-clear-filter.tsxβ β β βββ data-table-faceted-filter.tsxβ β β βββ data-table-slider-filter.tsxβ β β βββ data-table-date-filter.tsxβ β β βββ data-table-inline-filter.tsxβ β β βββ data-table-pagination.tsxβ β β βββ data-table-export-button.tsxβ β β βββ data-table-row-dnd.tsxβ β β βββ data-table-column-dnd.tsxβ β β βββ data-table-column-resize.tsx # Opt-in <DataTableColumnResize />β β β βββ data-table-column-auto-fit.tsx # Opt-in <DataTableColumnAutoFit /> (even-split fill)β β β βββ data-table-column-actions.tsxβ β β βββ data-table-column-header.tsxβ β β βββ data-table-column-title.tsxβ β β βββ data-table-column-sort.tsxβ β β βββ data-table-column-hide.tsxβ β β βββ data-table-column-pin.tsxβ β β βββ data-table-column-group.tsxβ β β βββ data-table-column-filter.tsxβ β β βββ data-table-column-filter-trigger.tsxβ β β βββ data-table-column-faceted-filter.tsxβ β β βββ data-table-column-date-filter-options.tsxβ β β βββ data-table-column-slider-filter-options.tsxβ β β βββ data-table-aside.tsxβ β β βββ data-table-selection-bar.tsxβ β β βββ data-table-toolbar-section.tsxβ β β βββ data-table-row-context-menu.tsx # Per-row right-click menu primitive (+ open-row highlight)β β β βββ data-table-row-context-menu-slot.tsx # Declarative <DataTableRowContextMenuSlot> for a bodyβ β β βββ data-table-row-menu.tsx # Polymorphic RowMenuItem/Sub/β¦ + DataTableRowMenuScope + useDataTableRowβ β β βββ data-table-empty-state.tsxβ β ββ β βββ grid/ # Data Grid (optional β editable spreadsheet layer)β β β βββ core/ # DataGrid, context, features, columns contextβ β β βββ cells/ # Text / number / select / date / checkbox editorsβ β β βββ components/ # Clipboard, fill, move, toolbar, status bar, β¦β β β βββ hooks/ # useDataGrid, useGridColumns, useGridChanges, β¦β β β βββ config/ # Keyboard shortcuts mapβ β β βββ types/ # CellState, GridRow, β¦β β ββ β βββ filters/ # Core filter implementations (accept `table` prop directly)β β β βββ table-search-filter.tsxβ β β βββ table-faceted-filter.tsxβ β β βββ table-slider-filter.tsxβ β β βββ table-range-filter.tsxβ β β βββ table-date-filter.tsxβ β β βββ table-inline-filter.tsxβ β β βββ table-filter-menu.tsxβ β β βββ table-clear-filter.tsxβ β β βββ table-view-menu.tsxβ β β βββ table-view-dnd-menu.tsxβ β β βββ table-sort-menu.tsxβ β β βββ table-pagination.tsxβ β β βββ table-export-button.tsxβ β β βββ table-row-dnd.tsxβ β β βββ table-column-dnd.tsxβ β β βββ table-column-actions.tsxβ β β βββ table-column-title.tsxβ β β βββ table-column-sort.tsxβ β β βββ table-column-hide.tsxβ β β βββ table-column-pin.tsxβ β β βββ table-column-group.tsxβ β β βββ table-column-faceted-filter.tsxβ β β βββ table-column-slider-filter.tsxβ β β βββ table-column-date-filter.tsxβ β ββ β βββ config/ # Configuration + feature detectionβ β β βββ data-table.tsβ β β βββ feature-detection.tsβ β ββ β βββ hooks/ # Custom React hooksβ β β βββ use-debounce.tsβ β β βββ use-derived-column-title.tsβ β β βββ use-generated-options.tsβ β β βββ use-keyboard-shortcut.tsβ β β βββ use-data-table-flash.ts # flashRows / flashCells helpersβ β β βββ use-data-table-scroll.ts # scrollRowIntoView helperβ β ββ β βββ lib/ # Utility functionsβ β β βββ constants.tsβ β β βββ data-table.tsβ β β βββ data-table-features.ts # TanStack Table v9 tableFeatures() + createDataTableColumnHelperβ β β βββ filter-functions.tsβ β β βββ filter-rows.tsβ β β βββ build-faceted-options.tsβ β β βββ format.tsβ β β βββ styles.tsβ β β βββ column-resize-handle.tsx # Shared resize grip (headers)β β β βββ flex-columns.ts # Flex fill + header-fit width resolution (on by default)β β β βββ use-header-min-widths.ts # Header-fit: measure header labels off-DOM to floor widthsβ β β βββ use-column-auto-fit.ts # Opt-in even-split fill: grow resizable columns to width on loadβ β β βββ use-column-sizing-persistence.ts # Opt-in: persist resized widths to localStorageβ β β βββ create-scroll-handler.ts # Shared scroll-listener factory used by every bodyβ β β βββ render-cell-content.tsx # Grouped / aggregated / placeholder cell rendererβ β β βββ row-click.ts # Shared row-click guard used by every bodyβ β ββ β βββ types/ # TypeScript typesβ β βββ index.tsβ ββ βββ lib/β βββ utils.ts # cn() utility (already in your project)ββββ package.jsonPrefer the CLI install when you only need a subset β each registry item pulls its own dependencies. Manual copy is best when you want the full tree (including optional Data Grid under grid/).
All Components
Section titled βAll ComponentsβBrowse and copy individual files below (includes grid/ when present on disk):
Additional Dependencies
Section titled βAdditional DependenciesβFor advanced features, you may need additional dependencies:
URL State Management (nuqs)
Section titled βURL State Management (nuqs)βFor URL state persistence in tables:
Virtualization
Section titled βVirtualizationβFor virtualized tables (and Data Grid):
Sortable Rows / Column DnD
Section titled βSortable Rows / Column DnDβFor drag-and-drop row or column reordering, install @dnd-kit/* as used by the row-dnd / column-dnd registry items, or follow the DiceUI Sortable installation guide.
Next Steps
Section titled βNext StepsβNow that you have all the components installed, check out the examples:
- Simple Table - Basic table with no pagination
- Basic Table - Add pagination and sorting
- Search Table - Add search functionality
- Faceted Filter Table - Add advanced filtering
- Column Resize Table - Drag / double-click column widths
- Data Grid - Editable spreadsheet on top of the virtualized table
- Advanced Table - All features combined
- Components catalog - Every
@niko-table/*registry item