Skip to content
Niko Table

User-Facing Components

Ready-to-use table components that find the table on their own. Start here.

These components find the table on their own through useDataTable. Use them for most tables.

Holds your filters and actions in the toolbar.

import { DataTableToolbarSection } from "@/components/niko-table/components/data-table-toolbar-section"
<DataTableToolbarSection className="flex justify-between">
<DataTableSearchFilter />
<DataTableViewMenu />
</DataTableToolbarSection>
Name Type Default Description
className string - Additional CSS classes.
children React.ReactNode - Filter and action components.

Pagination controls with page size and page navigation.

import { DataTablePagination } from "@/components/niko-table/components/data-table-pagination"
<DataTablePagination
pageSizeOptions={[10, 25, 50, 100]}
totalCount={500}
onPageChange={pageIndex => console.log("Page:", pageIndex)}
/>
Name Type Default Description
pageSizeOptions number[] [10, 25, 50, 100] Available page size options.
totalCount number - Total count of items (for server-side pagination).
isLoading boolean - Loading state (overrides context loading).
isFetching boolean - Fetching state (for TanStack Query).
disableNextPage boolean - Explicitly disable next page button.
disablePreviousPage boolean - Explicitly disable previous page button.
className string - Additional CSS classes.
Name Type Description
onPageChange (pageIndex: number) => void Called when page changes.
onNextPage (pageIndex: number) => void Called when navigating to next page.
onPreviousPage (pageIndex: number) => void Called when navigating to previous page.
onPageSizeChange (pageSize: number, pageIndex: number) => void Called when page size changes.
onPaginationReady () => void Called when pagination is initialized.

Note: Pagination buttons are disabled while isLoading or isFetching is true.

A global search input with debouncing. Works controlled or uncontrolled.

import { DataTableSearchFilter } from "@/components/niko-table/components/data-table-search-filter"
// Uncontrolled (manages its own state)
<DataTableSearchFilter placeholder="Search products..." />
// Controlled (you manage the state)
const [search, setSearch] = useState("")
<DataTableSearchFilter
value={search}
onChange={setSearch}
placeholder="Search..."
/>
// With nuqs for URL state
const [search, setSearch] = useQueryState('search')
<DataTableSearchFilter
value={search ?? ""}
onChange={setSearch}
/>
Name Type Default Description
placeholder string "Search..." Input placeholder text.
value string - Controlled value.
onChange (value: string) => void - Change handler for controlled mode.
showClearButton boolean true Show clear button when input has value.
className string - Additional CSS classes.

A command palette for adding filters, with advanced operators and AND/OR logic.

import { DataTableFilterMenu } from "@/components/niko-table/components/data-table-filter-menu"
<DataTableFilterMenu
autoOptions
dynamicCounts
showCounts
mergeStrategy="augment"
/>
Name Type Default Description
autoOptions boolean true Auto-generate options for select/multiSelect columns.
showCounts boolean true Show counts beside each option.
dynamicCounts boolean true Recompute counts based on filtered rows.
limitToFilteredRows boolean true Generate options from filtered rows only.
includeColumns string[] - Only generate options for these column ids.
excludeColumns string[] - Exclude these column ids from generation.
limitPerColumn number - Limit number of generated options per column.
mergeStrategy "preserve" | "augment" | "replace" "preserve" How to handle existing static options.
className string - Additional CSS classes.
Value Description
preserve Keep user-defined options untouched (default).
augment Add counts to matching values from static options.
replace Override static options with generated options.

A faceted filter for single or multiple selection. Options are generated from your data.

import { DataTableFacetedFilter } from "@/components/niko-table/components/data-table-faceted-filter"
// With static options
<DataTableFacetedFilter
accessorKey="category"
title="Category"
options={[
{ label: "Electronics", value: "electronics" },
{ label: "Clothing", value: "clothing" },
]}
multiple
/>
// Auto-generate options from data
<DataTableFacetedFilter
accessorKey="brand"
limitToFilteredRows={true}
/>
Name Type Default Description
accessorKey keyof TData & string - Column accessor key (required).
title string - Custom title (uses column.meta.label if not provided).
options Option[] - Static options array.
multiple boolean - Allow multiple selection.
showCounts boolean true Show counts beside each option.
dynamicCounts boolean true Recompute counts based on filtered rows.
limitToFilteredRows boolean !multiple Show only options from filtered rows.

Sets whether the filter lists options from all rows or only the filtered rows.

  • true: options come from rows that match the other active filters.
    • Good for a “Brand” filter where you only want relevant options.
    • Default for single-select (multiple={false}).
  • false: options come from all rows, whatever the other filters say.
    • Good for a “Category” filter where you want every option.
    • Default for multi-select (multiple={true}).

A menu for sorting columns. You can drag to reorder the sorts.

import { DataTableSortMenu } from "@/components/niko-table/components/data-table-sort-menu"
<DataTableSortMenu className="ml-auto" />
Name Type Default Description
className string - Additional CSS classes.
debounceMs number - Debounce delay for sort updates.
throttleMs number - Throttle delay for sort updates.
shallow boolean - Use shallow comparison for sort state.
onSortingChange (sorting: ColumnSort[]) => void - Callback when sorting changes.

A menu to show or hide columns, with search. For drag-to-reorder, use DataTableViewDndMenu. It lives in a separate file, so you only pay the @dnd-kit/* bundle cost if you use it.

import { DataTableViewMenu } from "@/components/niko-table/components/data-table-view-menu"
// Basic
<DataTableViewMenu />
// Surface required columns + Reset
<DataTableViewMenu
lockedColumnIds={["id", "name"]}
onReset={() => {
table.resetColumnVisibility()
table.resetColumnOrder()
}}
/>
Name Type Default Description
className string - Additional CSS classes.
onColumnVisibilityChange (columnId: string, isVisible: boolean) => void - Callback when visibility changes.
lockedColumnIds string[] - Columns shown in the menu but disabled. Good for required columns marked enableHiding: false.
onReset () => void - Shows a Reset button at the bottom of the menu when set.
resetLabel string "Reset to defaults" Label for the reset button.

A drag-to-reorder version of DataTableViewMenu.

  • Handles: each row gets a GripVertical handle. The list sorts vertically via @dnd-kit.
  • One state: the table’s columnOrder state drives the menu order. Dropping a row updates both.
import { DataTableViewDndMenu } from "@/components/niko-table/components/data-table-view-dnd-menu"
const [columnOrder, setColumnOrder] = React.useState<string[]>([])
<DataTableViewDndMenu
columnOrder={columnOrder}
onColumnOrderChange={setColumnOrder}
lockedColumnIds={["id"]}
onReset={() => {
setColumnOrder([])
table.resetColumnVisibility()
}}
/>
Name Type Default Description
columnOrder string[] - Current column order array (required).
onColumnOrderChange (next: string[]) => void - Callback when a row is dropped in a new position (required).
className string - Additional CSS classes.
onColumnVisibilityChange (columnId: string, isVisible: boolean) => void - Callback when visibility changes.
lockedColumnIds string[] - Columns shown in the menu but rendered disabled.
onReset () => void - Shows a Reset button below a separator when set.
resetLabel string "Reset to defaults" Label for the reset button.

An inline filter toolbar, with advanced operators and AND/OR logic.

import { DataTableInlineFilter } from "@/components/niko-table/components/data-table-inline-filter"
<DataTableInlineFilter
autoOptions
dynamicCounts
showCounts
mergeStrategy="augment"
/>

Same as DataTableFilterMenu. See that section above.

A slider filter for numeric ranges, with min and max inputs.

import { DataTableSliderFilter } from "@/components/niko-table/components/data-table-slider-filter"
// Auto-detect from column metadata
<DataTableSliderFilter accessorKey="price" />
// Custom range
<DataTableSliderFilter
accessorKey="rating"
min={1}
max={5}
step={0.5}
/>
// With unit
<DataTableSliderFilter
accessorKey="price"
range={[0, 1000]}
unit="$"
/>
Name Type Default Description
accessorKey keyof TData & string - Column accessor key (required).
title string - Custom title.
min number - Minimum value (read from your data if not set).
max number - Maximum value (read from your data if not set).
step number auto Step size. Calculated from the range (1 only for ranges ≤ 20).
range [number, number] - Range array [min, max] (overrides min/max).
unit string - Unit label (e.g., “$”, “kg”).

A date filter for single dates or date ranges.

import { DataTableDateFilter } from "@/components/niko-table/components/data-table-date-filter"
// Single date
<DataTableDateFilter accessorKey="releaseDate" />
// Date range
<DataTableDateFilter
accessorKey="releaseDate"
multiple
/>
Name Type Default Description
accessorKey keyof TData & string - Column accessor key (required).
title string - Custom title.
multiple boolean false Enable date range selection.

A button that clears all filters, sorting, and search.

import { DataTableClearFilter } from "@/components/niko-table/components/data-table-clear-filter"
<DataTableClearFilter />
Name Type Default Description
variant ButtonVariant "outline" Button variant.
size ButtonSize "sm" Button size.
showIcon boolean true Show clear icon.
children React.ReactNode - Button content.
enableResetColumnFilters boolean true Enable resetting column filters.
enableResetGlobalFilter boolean true Enable resetting global filter (search).
enableResetSorting boolean true Enable resetting sorting.
className string - Additional CSS classes.

A button that exports table data to CSV.

import { DataTableExportButton } from "@/components/niko-table/components/data-table-export-button"
// Basic usage
<DataTableExportButton filename="products" />
// With human-readable headers from column.meta.label
<DataTableExportButton filename="products" useHeaderLabels />
// Export only selected rows
<DataTableExportButton filename="selected" onlySelected />
Name Type Default Description
filename string "table" Filename for exported CSV (without extension).
excludeColumns (keyof TData)[] - Columns to exclude from export.
onlySelected boolean false Export only selected rows.
useHeaderLabels boolean false Use column.columnDef.meta.label as CSV headers instead of column IDs.
variant ButtonVariant "outline" Button variant.
size ButtonSize "sm" Button size.
label string "Export CSV" Button label.
showIcon boolean true Show download icon.
className string - Additional CSS classes.

The container for a column header. It lays out the title, actions, and filters.

import { DataTableColumnHeader } from "@/components/niko-table/components/data-table-column-header"
import { DataTableColumnTitle } from "@/components/niko-table/components/data-table-column-title"
import { DataTableColumnSortMenu } from "@/components/niko-table/components/data-table-column-sort"
const columns: DataTableColumnDef<User>[] = [
{
accessorKey: "name",
header: () => (
<DataTableColumnHeader>
<DataTableColumnTitle />
<DataTableColumnSortMenu />
</DataTableColumnHeader>
),
meta: { label: "Name" },
},
]
Name Type Description
children React.ReactNode Column header content.
className string Additional CSS classes.

Build the header from parts to change the layout or add custom filters.

import { DataTableColumnHeader } from "@/components/niko-table/components/data-table-column-header"
import { DataTableColumnTitle } from "@/components/niko-table/components/data-table-column-title"
import { DataTableColumnActions } from "@/components/niko-table/components/data-table-column-actions"
import { DataTableColumnFilter } from "@/components/niko-table/components/data-table-column-filter"
import { DataTableColumnFilterTrigger } from "@/components/niko-table/components/data-table-column-filter-trigger"
import { DataTableColumnSortOptions } from "@/components/niko-table/components/data-table-column-sort"
import { DataTableColumnHideOptions } from "@/components/niko-table/components/data-table-column-hide"
import { DataTableColumnPinOptions } from "@/components/niko-table/components/data-table-column-pin"
import { DataTableColumnGroupOptions } from "@/components/niko-table/components/data-table-column-group"
import { DataTableColumnFacetedFilterOptions } from "@/components/niko-table/components/data-table-column-faceted-filter"
import { DataTableColumnSliderFilterOptions } from "@/components/niko-table/components/data-table-column-slider-filter-options"
import { DataTableColumnDateFilterOptions } from "@/components/niko-table/components/data-table-column-date-filter-options"
const columns: DataTableColumnDef<User>[] = [
{
accessorKey: "status",
header: () => (
<DataTableColumnHeader>
<DataTableColumnTitle />
<DataTableColumnActions>
<DataTableColumnFilter>
<DataTableColumnFilterTrigger />
<DataTableColumnFacetedFilterOptions />
</DataTableColumnFilter>
<DataTableColumnSortOptions />
<DataTableColumnPinOptions />
<DataTableColumnGroupOptions />
<DataTableColumnHideOptions />
</DataTableColumnActions>
</DataTableColumnHeader>
),
meta: { label: "Status" },
},
]

Standalone filter menus can sit directly inside DataTableColumnHeader. You do not need DataTableColumnActions:

import { DataTableColumnHeader } from "@/components/niko-table/components/data-table-column-header"
import { DataTableColumnTitle } from "@/components/niko-table/components/data-table-column-title"
import { DataTableColumnSortMenu } from "@/components/niko-table/components/data-table-column-sort"
import { DataTableColumnFacetedFilterMenu } from "@/components/niko-table/components/data-table-column-faceted-filter"
import { DataTableColumnSliderFilterMenu } from "@/components/niko-table/components/data-table-column-slider-filter-options"
import { DataTableColumnDateFilterMenu } from "@/components/niko-table/components/data-table-column-date-filter-options"
import { FILTER_VARIANTS } from "@/components/niko-table/lib/constants"
const columns: DataTableColumnDef<Product>[] = [
{
accessorKey: "category",
header: () => (
<DataTableColumnHeader>
<DataTableColumnTitle />
<DataTableColumnSortMenu variant={FILTER_VARIANTS.TEXT} />
<DataTableColumnFacetedFilterMenu
multiple
limitToFilteredRows={false}
/>
</DataTableColumnHeader>
),
meta: { label: "Category" },
enableColumnFilter: true,
},
{
accessorKey: "price",
header: () => (
<DataTableColumnHeader>
<DataTableColumnTitle />
<DataTableColumnSortMenu variant={FILTER_VARIANTS.NUMBER} />
<DataTableColumnSliderFilterMenu />
</DataTableColumnHeader>
),
meta: { label: "Price", variant: "range" },
enableColumnFilter: true,
},
{
accessorKey: "releaseDate",
header: () => (
<DataTableColumnHeader>
<DataTableColumnTitle />
<DataTableColumnSortMenu />
<DataTableColumnDateFilterMenu />
</DataTableColumnHeader>
),
meta: { label: "Release Date", variant: "dateRange" },
enableColumnFilter: true,
},
]

DataTableHeader and DataTableVirtualizedHeader call flexRender(...) to draw the JSX your header function returns. The core components wrap that JSX in the <DataTableColumnHeaderRoot column={...}> provider.

So every component inside your header function (DataTableColumnHeader, DataTableColumnTitle, etc.) gets the column context. This holds even if you compose by hand in your columns definition.

For custom setups, you can use the column header context directly:

The provider that gives column context to child header components. DataTableHeader and DataTableVirtualizedHeader use it inside. You only need it for a fully custom header renderer.

import { DataTableColumnHeaderRoot } from "@/components/niko-table/components/data-table-column-header"
<DataTableColumnHeaderRoot column={column}>
{/* All child components receive column context */}
<DataTableColumnHeader>
<DataTableColumnTitle />
</DataTableColumnHeader>
</DataTableColumnHeaderRoot>
Name Type Description
column DataTableColumn<TData, TValue> Table column instance (required).
children React.ReactNode Child components.

Gives you the column header context (the current column). Use it in custom sub-components that need the column.

import { useColumnHeaderContext } from "@/components/niko-table/components/data-table-column-header"
function CustomHeaderButton() {
const { column } = useColumnHeaderContext(true)
return <button onClick={() => column.toggleSorting()}>Sort</button>
}
Parameter Type Description
required boolean If true, throws if used outside DataTableColumnHeaderRoot.

Shows the column title. Click it to toggle sort. Reads the column from context.

Name Type Default Description
title string - Custom title (uses column.meta.label if not provided).
className string - Additional CSS classes.

Holds the action icons and the dropdown menu for column options. It detects the active state (sorted, pinned, filtered) itself.

Name Type Default Description
children React.ReactNode - Action option components.
isActive boolean auto Override active state (auto-detected from context).
className string - Additional CSS classes.

Groups column filter components.

Name Type Description
children React.ReactNode Filter components.
className string Additional CSS classes.

A funnel icon button that opens column filters. Reads the column from context.

Name Type Description
className string Additional CSS classes.

Sort options to put inside DataTableColumnActions. Shows ascending, descending and clear in a dropdown.

Name Type Default Description
variant SortIconVariant "text" Sort icon variant ("text", "number", "date"). Auto-detected from column.meta.variant.
withSeparator boolean true Show a separator before the options.
className string - Additional CSS classes.

A standalone sort button for use outside dropdown menus. It is a button with a dropdown of sort options.

Name Type Default Description
variant SortIconVariant "text" Sort icon variant ("text", "number", "date"). Auto-detected from column.meta.variant.
className string - Additional CSS classes.

A one-line hint for multi-sort: “Hold Shift and click a column’s sort to sort by more than one column.” Put it in a toolbar. It renders nothing when enableMultiSort is false. Ships with data-table-column-sort.

<DataTableToolbarSection className="px-0">
<DataTableSortHint className="max-sm:hidden" />
<DataTableSortMenu className="ml-auto" />
</DataTableToolbarSection>
Name Type Description
className string Additional CSS classes (any <p> prop works).

Pin options to put inside DataTableColumnActions. Shows pin left, pin right and unpin.

Name Type Description
className string Additional CSS classes.

A standalone pin menu for the column header. It is a button.

Name Type Description
className string Additional CSS classes.

Group options to put inside DataTableColumnActions. Shows Group by and Stop grouping by. Feature detection turns on getGroupedRowModel and expand/collapse. For nested data, use a Tree Table (getSubRows) instead. Do not combine the two.

Name Type Default Description
withSeparator boolean true Whether to render a separator before the options.

A standalone group menu for the column header. It is a button.

Name Type Description
className string Additional CSS classes.

A hide-column option to put inside DataTableColumnActions.

Name Type Description
className string Additional CSS classes.

A standalone hide menu for the column header. It is a button.

Name Type Description
className string Additional CSS classes.

Faceted filter options to put inside DataTableColumnActions. Shows a multi-select list.

Name Type Description
column DataTableColumn<TData> Optional override (auto-detected from context).
options Option[] Static options array.
multiple boolean Allow multiple selection.
className string Additional CSS classes.

A standalone faceted filter popover for the column header. It is a button with a filter icon. Without explicit options, it builds them from your row data.

Name Type Default Description
column DataTableColumn<TData> - Optional override (auto-detected from context).
options Option[] - Static options array (auto-generated if omitted).
multiple boolean - Allow multiple selection.
limitToFilteredRows boolean !multiple Show only options from filtered rows (false = all rows); defaults on for single-select, off for multi.
className string - Additional CSS classes.

Slider options to put inside DataTableColumnActions. Shows a range slider for numeric columns.

Name Type Description
column DataTableColumn<TData> Optional override (auto-detected from context).
min number Minimum value.
max number Maximum value.
step number Step increment.
className string Additional CSS classes.

A standalone slider filter popover for the column header. It is a button with a slider icon.

Name Type Description
column DataTableColumn<TData> Optional override (auto-detected from context).
min number Minimum value.
max number Maximum value.
step number Step increment.
className string Additional CSS classes.

Date options to put inside DataTableColumnActions. Shows a date picker for date columns.

Name Type Description
column DataTableColumn<TData> Optional override (auto-detected from context).
multiple boolean Enable date range selection.
className string Additional CSS classes.

A standalone date filter popover for the column header. It is a button with a calendar icon.

Name Type Description
column DataTableColumn<TData> Optional override (auto-detected from context).
multiple boolean Enable date range selection.
className string Additional CSS classes.

A sidebar next to the table for extra content (filters, details, etc.).

import {
DataTableAside,
DataTableAsideTrigger,
DataTableAsideContent,
DataTableAsideHeader,
DataTableAsideTitle,
DataTableAsideDescription,
DataTableAsideClose,
} from "@/components/niko-table/components/data-table-aside"
<DataTableAside side="right">
<DataTableAsideTrigger>Open Filters</DataTableAsideTrigger>
<DataTableAsideContent>
<DataTableAsideHeader>
<DataTableAsideTitle>Filters</DataTableAsideTitle>
<DataTableAsideDescription>Filter your data</DataTableAsideDescription>
<DataTableAsideClose />
</DataTableAsideHeader>
{/* filter content */}
</DataTableAsideContent>
</DataTableAside>
Name Type Default Description
children React.ReactNode - Aside components (Trigger, Content).
side "left" | "right" "right" Side of the table to display the aside.
open boolean - Controlled open state.
onOpenChange (open: boolean) => void - Callback when open state changes.
defaultOpen boolean false Initial open state (uncontrolled).
Name Type Default Description
children React.ReactNode - Trigger content.
asChild boolean false Render as child element.
className string - Additional CSS classes.
Name Type Default Description
children React.ReactNode - Aside content.
width string "w-1/2" Width of the aside (Tailwind class).
sticky boolean false Make aside sticky.
className string - Additional CSS classes.

Shows bulk actions when rows are selected.

import { DataTableSelectionBar } from "@/components/niko-table/components/data-table-selection-bar"
<DataTableSelectionBar
selectedCount={table.getSelectedRowModel().rows.length}
onClear={() => table.resetRowSelection()}
>
<Button onClick={handleDelete}>Delete Selected</Button>
<Button onClick={handleExport}>Export Selected</Button>
</DataTableSelectionBar>
Name Type Default Description
selectedCount number - Number of selected rows (required).
onClear () => void - Callback to clear selection.
children React.ReactNode - Custom action buttons.
className string - Additional CSS classes.

Pieces for building your own empty state.

import {
DataTableEmptyIcon,
DataTableEmptyMessage,
DataTableEmptyTitle,
DataTableEmptyDescription,
DataTableEmptyFilteredMessage,
DataTableEmptyActions,
} from "@/components/niko-table/components/data-table-empty-state"
import { DataTableEmptyBody } from "@/components/niko-table/core/data-table-structure"
import { PackageOpen } from "lucide-react"
// Complete empty state composition
<DataTableEmptyBody>
<DataTableEmptyIcon>
<PackageOpen className="size-12 text-muted-foreground" />
</DataTableEmptyIcon>
<DataTableEmptyMessage>
<DataTableEmptyTitle>No products found</DataTableEmptyTitle>
<DataTableEmptyDescription>
Get started by adding your first product to the catalog.
</DataTableEmptyDescription>
</DataTableEmptyMessage>
<DataTableEmptyFilteredMessage>
No products match your current filters. Try adjusting your search criteria.
</DataTableEmptyFilteredMessage>
<DataTableEmptyActions>
<Button onClick={handleAddProduct}>Add Product</Button>
<Button variant="outline" onClick={handleImport}>
Import from CSV
</Button>
</DataTableEmptyActions>
</DataTableEmptyBody>

The icon for an empty state.

Name Type Description
children React.ReactNode Icon element.
className string Additional CSS classes.

Message shown when the table has no data (no filters applied).

Name Type Description
children React.ReactNode Message content.
className string Additional CSS classes.

Message shown when filters match nothing.

Name Type Description
children React.ReactNode Message content.
className string Additional CSS classes.

The title of an empty state.

Name Type Description
children React.ReactNode Title text.
className string Additional CSS classes.

The description of an empty state.

Name Type Description
children React.ReactNode Description text.
className string Additional CSS classes.

The actions of an empty state (buttons, links, etc.).

Name Type Description
children React.ReactNode Action buttons/links.
className string Additional CSS classes.

Opt-in column resizing. Put <DataTableColumnResize /> inside DataTableRoot to add drag grips (plus keyboard nudge and double-click autosize) to every header that allows resizing.

  • Works with: regular and virtualized headers.
  • Opt out per column: enableResizing: false.
  • Flex fill (on by default): one column takes the leftover width so the table fills its container. Dragging the fill column fixes its width and moves the fill to the next eligible column.
  • Header-fit (on by default): columns you have not resized are at least as wide as their header label, so labels are not cut off.
  • Drag preview: a guide line shows the drag. The new width applies on release (columnResizeMode: "onEnd").

See the Column Resize Table example.

import { DataTableColumnResize } from "@/components/niko-table/components/data-table-column-resize"
<DataTableRoot data={data} columns={columns}>
<DataTableColumnResize />
<DataTable>
<DataTableHeader />
<DataTableBody />
</DataTable>
</DataTableRoot>
Name Type Description
(none) - No props. Adding it enables resize for the table.

An opt-in marker that swaps the single flex column for an even split.

  • What it does: on load, every resizable column grows by an equal share of the leftover width.
  • Needs: <DataTableColumnResize />. It does nothing unless resizing is on.
  • Re-fits: when the container grows.
  • Backs off: once the user resizes a column or a saved columnSizing is restored. Manual and saved widths win.

See Auto-fit.

import { DataTableColumnAutoFit } from "@/components/niko-table/components/data-table-column-auto-fit"
<DataTableRoot data={data} columns={columns}>
<DataTableColumnResize />
<DataTableColumnAutoFit />
<DataTable>
<DataTableHeader />
<DataTableBody />
</DataTable>
</DataTableRoot>
Name Type Description
(none) - No props. Adding it enables auto-fit for the table.

DnD wrappers that read the table from context. They pair with the core Table*DndProvider components in filters/. Use these by default.

Wraps the table with row DnD context. It finds DataTableRoot through useDataTable.

import { DataTableRowDndProvider, DataTableRowDragHandle } from "@/components/niko-table/components/data-table-row-dnd"
<DataTableRowDndProvider data={data} onReorder={setData}>
<DataTable>
<DataTableHeader />
<DataTableDndBody />
</DataTable>
</DataTableRowDndProvider>
Name Type Default Description
data TData[] - The current data array (required).
onReorder (data: TData[], move: { activeId: UniqueIdentifier; overId: UniqueIdentifier }) => void - Callback with the reordered data array (required). The second argument says which row id moved onto which.
children React.ReactNode - Table components to wrap.

Makes one table row draggable. DataTableDndBody uses it for each row. You can also use it in custom row layouts. It wraps the core TableDraggableRow from filters/.

import { DataTableDraggableRow } from "@/components/niko-table/components/data-table-row-dnd"
<DataTableDraggableRow row={row}>
{row.getVisibleCells().map(cell => (
<TableCell key={cell.id}>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</TableCell>
))}
</DataTableDraggableRow>
Name Type Default Description
row DataTableRow<TData> - TanStack Table row instance (required).
children React.ReactNode - Row content (e.g. cells).
className string - Additional CSS classes.

A grip-icon button that starts a row drag. It uses useSortable inside.

Name Type Default Description
rowId string - Unique row identifier for sortable (required).
className string - Additional CSS classes.

Wraps the table with column DnD context (horizontal axis).

import { DataTableColumnDndProvider } from "@/components/niko-table/components/data-table-column-dnd"
<DataTableColumnDndProvider columnOrder={columnOrder} onColumnOrderChange={setColumnOrder}>
<DataTable>
<DataTableDndHeader />
<DataTableDndColumnBody />
</DataTable>
</DataTableColumnDndProvider>
Name Type Default Description
columnOrder string[] - Current column order array (required).
onColumnOrderChange (columnOrder: string[]) => void - Callback with the new column order (required).
children React.ReactNode - Table components to wrap.

Wraps TableDraggableHeader and makes header cells draggable.

Name Type Default Description
header DataTableHeader<TData, TValue> - TanStack Table header instance (required).
children React.ReactNode - Header content.
className string - Additional CSS classes.

Wraps TableDragAlongCell. The cell follows its column while it is dragged.

Name Type Default Description
cell DataTableCell<TData, TValue> - TanStack Table cell instance (required).
children React.ReactNode - Cell content.
className string - Additional CSS classes.

The column header is split into small files.

  • Entry point: DataTableColumnHeader (above). You render it in your column header callbacks.
  • Building blocks: the pieces below. DataTableColumnHeader uses them inside.
  • Why they are exported: for a fully custom header, you can use only the parts you want (for example just the sort menu, or just pin and hide). Most people never import them.
  • How they work: each module is a thin wrapper around its filters/table-column-* filter, which holds the TanStack Table logic. The wrapper adds context and UI through useColumnHeaderContext.

The dropdown trigger at the end of a column header (the ⋮ button). It is built from the sort, hide, pin, and faceted-filter pieces. It shows only the items that fit the column’s meta. Used inside DataTableColumnHeader.

The column’s title text. It comes from column.columnDef.meta?.label or the accessor key (via useDerivedColumnTitle). Wraps TableColumnTitle from filters/.

The per-column sort items (Asc, Desc, Clear), with icons for the column variant from SORT_ICONS / SORT_LABELS. Shows nothing when column.getCanSort() is false. Wraps TableColumnSort from filters/.

The “Hide column” item. Respects column.getCanHide(). Wraps TableColumnHide from filters/.

The “Pin to left”, “Pin to right” and “Unpin” items. Respects column.getCanPin(). Wraps TableColumnPin from filters/.

The Group by and Stop grouping by items. Respects column.getCanGroup(). Wraps TableColumnGroup from filters/. See Grouping Table. This is not a Tree Table (getSubRows). Use one or the other per table.

Picks the right per-column filter UI from column.columnDef.meta?.variant (text, number, range, date, select, multiSelect, boolean). It mounts the filter for that variant (data-table-column-faceted-filter, data-table-column-slider-filter-options, data-table-column-date-filter-options) only when the user opens the filter panel.

The <button> in the column header that opens the filter popover. Its label and active state change when the column has a filter value.

The per-column faceted multi-select filter (for select and multiSelect columns). It builds options with useGeneratedOptions and passes dynamicCounts and limitToFilteredRows on to the option builder. Wraps TableColumnFacetedFilter from filters/.

The per-column date and date-range filter (date picker plus operator selector). Backed by TableColumnDateFilter from filters/. data-table-column-filter mounts it when the column variant is date or dateRange.

The per-column numeric range slider. Without explicit min and max, it uses the column’s faceted min and max. Backed by TableColumnSliderFilter from filters/. data-table-column-filter mounts it when the column variant is range.