Skip to content
Niko Table

Manual Installation

Copy the DataTable files into your project by hand.

You need:

  1. A React project (Next.js, Vite, etc.)
  2. Shadcn UI set up in your project (Installation Guide)
  3. TailwindCSS configured
  4. TypeScript (recommended)

Using Base UI ("style": "base-nova")? Use the CLI install instead.

  • The CLI changes the source to Base UI idioms (asChild becomes render) during install.
  • The files on this page are for Radix (new-york).

DataTable has two layers:

  • Components (data-table-*.tsx in /components): wrappers that get the table from DataTableRoot context through useDataTable(). You do not pass props down. This is the recommended layer:
    • DataTableSearchFilter, DataTableFilterMenu, DataTableSortMenu, DataTablePagination, etc.
  • Filters (table-*.tsx in /filters): the core pieces. They take a table prop and read the TanStack Table instance (like table.state and table.setGlobalFilter()). You can use them on their own:
    • TableSearchFilter, TableFilterMenu, TableSortMenu, etc.

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.
  1. Install the required dependencies

    This registry uses TanStack Table v9:

    pnpm add @tanstack/react-table@^9

    You also need lib/data-table-features.ts from the files below. It is the tableFeatures() list that DataTableRoot passes to useTable. See Table Features.

  2. Install the required Shadcn UI components

    The registry adds most Shadcn dependencies for you. For a manual install, you need:

    pnpm dlx shadcn@latest add button input dropdown-menu
  3. Copy the custom table component

    DataTable needs a custom components/ui/table.tsx that exports TableComponent. Copy it from the files below, or install it with the registry CLI (see the Installation Guide).

  4. Copy all DataTable components

    Copy all the files below into your project. Keep the folder structure shown.

  5. Update import paths

    Change the import paths in the copied files to match your project. The components use:

    • @/components/ui/ for Shadcn UI components

    • @/components/niko-table/ for DataTable components

    • @/lib/ for utility functions

    • Make sure the @/ path alias points at your src/ 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 or @/components/niko-table/lib/constants. This lets bundlers tree-shake, and matches the shadcn pattern of one entry point per component.

  6. 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 = [
    { id: "1", name: "John Doe", email: "[email protected]" },
    { id: "2", name: "Jane Smith", email: "[email protected]" },
    ]
    export function TestTable() {
    return (
    <DataTableRoot data={data} columns={columns}>
    <DataTable>
    <DataTableHeader />
    <DataTableBody />
    </DataTable>
    </DataTableRoot>
    )
    }

After copying all files, your project looks 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/ # Niko 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.json
  • Need only some pieces? Use the CLI install. Each registry item pulls in its own dependencies.
  • Want the full tree? Copy by hand. This includes the optional Niko Grid under grid/.

Browse and copy each file below (includes grid/ when it exists on disk):

Some features need extra dependencies:

To keep table state in the URL:

pnpm add nuqs

For virtualized tables (and Niko Grid):

pnpm add @tanstack/react-virtual

For drag-and-drop row or column reordering, install @dnd-kit/* as the row-dnd and column-dnd registry items do. Or follow the DiceUI Sortable installation guide.

The components are installed. Try the examples: