Skip to content
Niko Table

Filter Components

Core filter components that take a table prop. Use them to build custom filters.

These filters take a table prop directly. The components in components/ use them inside. You can also use them on their own in custom components.

The core search input.

import { TableSearchFilter } from "@/components/niko-table/filters/table-search-filter"
<TableSearchFilter table={table} placeholder="Search..." />
Name Type Default Description
table DataTableInstance<TData> - TanStack Table instance (required).
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.

The core pagination controls.

import { TablePagination } from "@/components/niko-table/filters/table-pagination"
// Basic usage
<TablePagination table={table} />
// With custom page size options
<TablePagination
table={table}
pageSizeOptions={[10, 25, 50, 100]}
/>
// With total count for server-side pagination
<TablePagination
table={table}
totalCount={500}
onPageChange={(pageIndex) => console.log("Page:", pageIndex)}
/>

Same as DataTablePagination, plus a required table prop. See the DataTablePagination section above.

The core filter menu, styled like a command palette.

import { TableFilterMenu } from "@/components/niko-table/filters/table-filter-menu"
import { useState } from "react"
import type { ExtendedColumnFilter } from "@/components/niko-table/types"
// Controlled mode
const [filters, setFilters] = useState<ExtendedColumnFilter<Product>[]>([])
<TableFilterMenu
table={table}
filters={filters}
onFiltersChange={setFilters}
/>
Name Type Description
table DataTableInstance<TData> TanStack Table instance (required).
filters ExtendedColumnFilter<TData>[] Controlled filters array.
onFiltersChange (filters: ExtendedColumnFilter<TData>[] | null) => void Callback when filters change.
className string Additional CSS classes.

The module also exports two helpers to save menu filters (URL params, controlled state):

import {
normalizeFiltersFromUrl,
serializeFiltersForUrl,
} from "@/components/niko-table/filters/table-filter-menu"
// Writing: strip filterId to keep URLs short
const urlFilters = serializeFiltersForUrl(filters)
// Reading: regenerate missing filterIds deterministically
const restored = normalizeFiltersFromUrl(urlFilters)

filterId is internal to the menu UI. Regenerating it the same way each time keeps input focus steady across re-renders. See the Server-Side Nuqs Table example for full wiring.

The core faceted filter.

import { TableFacetedFilter } from "@/components/niko-table/filters/table-faceted-filter"
// Basic usage with static options
<TableFacetedFilter
column={table.getColumn("category")}
title="Category"
options={[
{ label: "Electronics", value: "electronics" },
{ label: "Clothing", value: "clothing" },
]}
/>
// With multiple selection
<TableFacetedFilter
column={table.getColumn("brand")}
title="Brand"
options={brandOptions}
multiple
onValueChange={(value) => console.log("Selected:", value)}
/>
Name Type Description
column DataTableColumn<TData, TValue> Table column instance (required).
title string Filter title.
options Option[] Static options array.
multiple boolean Allow multiple selection.
onValueChange (value: string[] | undefined) => void Callback when value changes.

The core slider filter for numeric ranges.

import { TableSliderFilter } from "@/components/niko-table/filters/table-slider-filter"
// Basic usage (auto-detects range from data)
<TableSliderFilter
column={table.getColumn("price")}
title="Price"
/>
// With custom range
<TableSliderFilter
column={table.getColumn("rating")}
title="Rating"
min={1}
max={5}
step={0.5}
/>
// With unit and range array
<TableSliderFilter
column={table.getColumn("price")}
title="Price Range"
range={[0, 1000]}
unit="$"
onValueChange={(value) => console.log("Range:", value)}
/>
Name Type Description
column DataTableColumn<TData> Table column instance (required).
title string Filter title.
range [number, number] Manual range [min, max].
min number Manual minimum value.
max number Manual maximum value.
step number Step increment.
unit string Unit label (e.g., “$”, “kg”).
onValueChange (value: [number, number] | undefined) => void Callback when value changes.

The core date filter.

import { TableDateFilter } from "@/components/niko-table/filters/table-date-filter"
// Single date selection
<TableDateFilter
column={table.getColumn("releaseDate")}
title="Release Date"
/>
// Date range selection
<TableDateFilter
column={table.getColumn("createdAt")}
title="Created Date"
multiple
/>
Name Type Description
column DataTableColumn<TData> Table column instance (required).
title string Filter title.
multiple boolean Enable date range selection.

The core sort menu.

import { TableSortMenu } from "@/components/niko-table/filters/table-sort-menu"
// Basic usage
<TableSortMenu table={table} />
// With debounce for performance
<TableSortMenu
table={table}
debounceMs={300}
onSortingChange={(sorting) => console.log("Sorting:", sorting)}
/>
// With throttle instead of debounce
<TableSortMenu
table={table}
throttleMs={200}
shallow
/>
Name Type Description
table DataTableInstance<TData> TanStack Table instance (required).
debounceMs number Debounce delay for sort updates.
throttleMs number Throttle delay for sort updates.
shallow boolean Use shallow comparison for sort state.
className string Additional CSS classes.
onSortingChange (sorting: ColumnSort[]) => void Callback when sorting changes.

The core menu for column visibility. For drag-to-reorder, use TableViewDndMenu. It lives in a separate file, so you only pay the @dnd-kit/* bundle cost if you use it.

import { TableViewMenu } from "@/components/niko-table/filters/table-view-menu"
// Basic usage
<TableViewMenu table={table} />
// With visibility change callback
<TableViewMenu
table={table}
onColumnVisibilityChange={(columnId, isVisible) => {
console.log(`Column ${columnId} is now ${isVisible ? "visible" : "hidden"}`)
}}
/>
// Surface required columns + a Reset action
<TableViewMenu
table={table}
lockedColumnIds={["id", "name"]}
onReset={() => {
table.resetColumnVisibility()
table.resetColumnOrder()
}}
/>
Name Type Description
table DataTableInstance<TData> TanStack Table instance (required).
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 Label for the reset button. Defaults to "Reset to defaults".

A drag-to-reorder version of TableViewMenu.

  • 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.
  • Works with header drag: pair it with TableColumnDndProvider. Two ways to reorder, one state.
import { TableViewDndMenu } from "@/components/niko-table/filters/table-view-dnd-menu"
const [columnOrder, setColumnOrder] = React.useState<string[]>([])
<TableViewDndMenu
table={table}
columnOrder={columnOrder}
onColumnOrderChange={setColumnOrder}
lockedColumnIds={["id"]}
onReset={() => {
setColumnOrder([])
table.resetColumnVisibility()
}}
/>
Name Type Description
table DataTableInstance<TData> TanStack Table instance (required).
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 Label for the reset button. Defaults to "Reset to defaults".

The core inline filter, with advanced operators.

import { TableInlineFilter } from "@/components/niko-table/filters/table-inline-filter"
import { useState } from "react"
import type { ExtendedColumnFilter } from "@/components/niko-table/types"
// Controlled mode with filters
const [filters, setFilters] = useState<ExtendedColumnFilter<Product>[]>([])
<TableInlineFilter
table={table}
filters={filters}
onFiltersChange={setFilters}
/>
Name Type Description
table DataTableInstance<TData> TanStack Table instance (required).
filters ExtendedColumnFilter<TData>[] Controlled filters array.
onFiltersChange (filters: ExtendedColumnFilter<TData>[]) => void Callback when filters change.
className string Additional CSS classes.

The core button that clears filters.

import { TableClearFilter } from "@/components/niko-table/filters/table-clear-filter"
// Basic usage
<TableClearFilter table={table} />
// With custom styling
<TableClearFilter
table={table}
variant="ghost"
size="sm"
/>
// Custom content
<TableClearFilter table={table}>
Reset All
</TableClearFilter>
// Selective reset (only filters, not sorting)
<TableClearFilter
table={table}
enableResetSorting={false}
/>
Name Type Default Description
table DataTableInstance<TData> - TanStack Table instance (required).
variant "default" | "outline" | "ghost" "outline" Button variant.
size "default" | "sm" | "lg" "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.

The core CSV export button.

import { TableExportButton, exportTableToCSV } from "@/components/niko-table/filters/table-export-button"
// Basic usage
<TableExportButton table={table} />
// With custom filename
<TableExportButton
table={table}
filename="products-export"
/>
// Exclude specific columns
<TableExportButton
table={table}
filename="products"
excludeColumns={["id", "internalNotes"]}
/>
// Export only selected rows
<TableExportButton
table={table}
onlySelected
label="Export Selected"
/>
// With human-readable headers from column.meta.label
<TableExportButton
table={table}
filename="products"
useHeaderLabels
/>
Name Type Default Description
table DataTableInstance<TData> - TanStack Table instance (required).
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.

A function that exports a TanStack Table to CSV. Use it when you want to control when and how the export runs.

import { exportTableToCSV } from "@/components/niko-table/filters/table-export-button"
// Basic export
exportTableToCSV(table, { filename: "users" })
// Export with human-readable headers from column.meta.label
exportTableToCSV(table, { filename: "users", useHeaderLabels: true })
// Export only selected rows, excluding certain columns
exportTableToCSV(table, {
filename: "selected-users",
onlySelected: true,
excludeColumns: ["id", "internalNotes"],
})
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.

The core range filter for numeric inputs.

import { TableRangeFilter } from "@/components/niko-table/filters/table-range-filter"
import type { ExtendedColumnFilter } from "@/components/niko-table/types"
// Basic usage with filter configuration
const filter: ExtendedColumnFilter<Product> = {
filterId: "price-range",
id: "price",
variant: "range",
operator: "between",
value: ["0", "100"],
}
<TableRangeFilter
filter={filter}
column={table.getColumn("price")}
inputId="price-min"
onFilterUpdate={(filterId, updates) => {
console.log("Filter updated:", filterId, updates)
}}
/>
Name Type Description
filter ExtendedColumnFilter<TData> Filter configuration (required).
column DataTableColumn<TData> Table column instance (required).
inputId string Unique input ID (required).
onFilterUpdate (filterId: string, updates: Partial<Omit<ExtendedColumnFilter<TData>, "filterId">>) => void Callback when filter updates.
className string Additional CSS classes.

The DataTableColumnHeader sub-components use these inside. They take column and/or table props directly. Use them on their own to build custom column headers.

The core column title. Click it to toggle sorting.

import { TableColumnTitle } from "@/components/niko-table/filters/table-column-title"
<TableColumnTitle column={column} title="Custom Title" />
Name Type Description
column DataTableColumn<TData, TValue> Table column instance (required).
title string Custom title (uses column.meta.label if not provided).
className string Additional CSS classes.

The core container for column actions. It renders a dropdown trigger with an active indicator.

import { TableColumnActions } from "@/components/niko-table/filters/table-column-actions"
<TableColumnActions isActive={column.getIsSorted() !== false}>
{/* Sort, pin, hide options */}
</TableColumnActions>
Name Type Default Description
children React.ReactNode - Action option components.
isActive boolean false Whether to show active indicator (dot on trigger).
className string - Additional CSS classes.

TableColumnSortOptions / TableColumnSortMenu

Section titled “TableColumnSortOptions / TableColumnSortMenu”

Core sorting pieces.

  • TableColumnSortOptions: sort items inside a dropdown menu.
  • TableColumnSortMenu: a standalone sort button.
import {
TableColumnSortOptions,
TableColumnSortMenu,
} from "@/components/niko-table/filters/table-column-sort"
// Inside a dropdown menu
<TableColumnSortOptions column={column} table={table} />
// Standalone button
<TableColumnSortMenu column={column} table={table} />
Name Type Description
column DataTableColumn<TData> Table column instance (required).
table DataTableInstance<TData> TanStack Table instance (required).
className string Additional CSS classes.

TableColumnHideOptions / TableColumnHideMenu

Section titled “TableColumnHideOptions / TableColumnHideMenu”

Core hide-column pieces.

  • TableColumnHideOptions: a hide item inside a dropdown menu.
  • TableColumnHideMenu: a standalone button.
import {
TableColumnHideOptions,
TableColumnHideMenu,
} from "@/components/niko-table/filters/table-column-hide"
// Inside a dropdown menu
<TableColumnHideOptions column={column} />
// Standalone button
<TableColumnHideMenu column={column} />
Name Type Description
column DataTableColumn<TData, TValue> Table column instance (required).
className string Additional CSS classes.

TableColumnPinOptions / TableColumnPinMenu

Section titled “TableColumnPinOptions / TableColumnPinMenu”

Core column pinning pieces.

  • TableColumnPinOptions: pin left, pin right and unpin items inside a dropdown menu.
  • TableColumnPinMenu: a standalone button.
import {
TableColumnPinOptions,
TableColumnPinMenu,
} from "@/components/niko-table/filters/table-column-pin"
// Inside a dropdown menu
<TableColumnPinOptions column={column} />
// Standalone button
<TableColumnPinMenu column={column} />
Name Type Description
column DataTableColumn<TData, TValue> Table column instance (required).
className string Additional CSS classes.

TableColumnFacetedFilterOptions / TableColumnFacetedFilterMenu

Section titled “TableColumnFacetedFilterOptions / TableColumnFacetedFilterMenu”

Core faceted filters for column headers.

  • TableColumnFacetedFilterOptions: renders inside a dropdown.
  • TableColumnFacetedFilterMenu: a standalone popover.
import {
TableColumnFacetedFilterOptions,
TableColumnFacetedFilterMenu,
} from "@/components/niko-table/filters/table-column-faceted-filter"
// Inside a dropdown menu
<TableColumnFacetedFilterOptions column={column} options={options} />
// Standalone popover
<TableColumnFacetedFilterMenu column={column} table={table} options={options} />
Name Type Description
column DataTableColumn<TData> Table column instance (required).
table DataTableInstance<TData> TanStack Table instance (Menu only).
options Option[] Static options array.
multiple boolean Allow multiple selection.
className string Additional CSS classes.

The button that opens the column filter popover.

  • Icon: a filter icon, or a filter-clear icon when the column is filtered.
  • Pairs with: TableColumnFacetedFilterOptions or TableColumnFacetedFilterMenu.
  • Props: column, plus any standard Button props.
import { TableColumnFilterTrigger } from "@/components/niko-table/filters/table-column-faceted-filter"
<TableColumnFilterTrigger column={column} />
Name Type Default Description
column DataTableColumn<TData, TValue> - TanStack Table column instance (required).
className string - Additional CSS classes.

All other props are passed through to the underlying Button component.

The core slider filter for column headers. It shows a range slider in a dropdown menu.

import { TableColumnSliderFilterOptions } from "@/components/niko-table/filters/table-column-slider-filter"
<TableColumnSliderFilterOptions column={column} min={0} max={1000} step={10} />
Name Type Description
column DataTableColumn<TData> Table column instance (required).
min number Minimum value.
max number Maximum value.
step number Step increment.
className string Additional CSS classes.

The core date filter for column headers. It shows a date picker in a dropdown menu.

import { TableColumnDateFilterOptions } from "@/components/niko-table/filters/table-column-date-filter"
<TableColumnDateFilterOptions column={column} multiple />
Name Type Description
column DataTableColumn<TData> Table column instance (required).
multiple boolean Enable date range selection.
className string Additional CSS classes.

Wraps the table with row DnD context and sensors. It runs arrayMove for you and calls onReorder with the new data array.

import { TableRowDndProvider, TableDraggableRow, TableRowDragHandle } from "@/components/niko-table/filters/table-row-dnd"
<TableRowDndProvider data={data} onReorder={setData}>
{/* table content */}
</TableRowDndProvider>
Name Type 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.
modifiers Modifier[] DnD modifiers (defaults to vertical axis).

Makes a table row draggable (via @dnd-kit/sortable).

Name Type Description
children React.ReactNode Row cell content.
rowId string Unique row identifier for sortable (required).
className string Additional CSS classes.

A grip-icon cell that starts a row drag.

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

Wraps the table with horizontal column DnD context. It runs arrayMove on the column order.

import { TableColumnDndProvider, TableDraggableHeader, TableDragAlongCell } from "@/components/niko-table/filters/table-column-dnd"
<TableColumnDndProvider columnOrder={columnOrder} onColumnOrderChange={setColumnOrder}>
{/* table content */}
</TableColumnDndProvider>
Name Type 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.
modifiers Modifier[] DnD modifiers (defaults to restrictToHorizontalAxis).

Makes a header cell draggable to reorder columns.

Name Type Description
header DataTableHeader<TData, TValue> TanStack Table header instance (required).
children React.ReactNode Header content.
className string Additional CSS classes.
style CSSProperties Additional styles merged with DnD transforms.

A cell that follows its column while it is dragged.

Name Type Description
cell DataTableCell<TData, TValue> TanStack Table cell instance (required).
children React.ReactNode Cell content.
className string Additional CSS classes.
style CSSProperties Additional styles merged with DnD transforms.