Components
Overview of all DataTable components organized by directory structure.
The components in data-table are built to be composable. You build your table by putting the provided components together. They also compose well with other shadcn/ui components.
If you need to change the code, you are encouraged to do so. The code is yours.
Directory Structure
Section titled “Directory Structure”The Niko Table components are organized into logical directories following the file structure in src/components/niko-table:
core/- Essential table components (DataTableRoot, DataTable, context, structure components)components/- User-facing context-aware components (automatically connect to table context viauseDataTablehook)filters/- Core filter implementation components (accepttableprop directly, used by components/)hooks/- Custom React hooks for table functionalitylib/- Utility functions and constantstypes/- TypeScript type definitionsconfig/- Configuration and feature detection
This documentation follows this structure for easy navigation. Each component section includes links to source code and relevant documentation.
Documentation Sections
Section titled “Documentation Sections”Essential building blocks of the data table. They handle table initialization, context management, and basic structure.
Components:
DataTableRoot- Provides table context and initializes TanStack TableDataTable- Main table container with scrolling behaviorDataTableHeader- Table header with sortable columnsDataTableBody- Table body with rows and scroll eventsDataTableSkeleton- Loading skeletonDataTableEmptyBody- Empty state componentDataTableLoading- Loading indicatorDataTableErrorBoundary- Error boundary for table- Virtualized components for large datasets
Context-aware components that automatically connect to the table via the useDataTable hook. These are the recommended components for most use cases.
Components:
DataTableToolbarSection- Container for filters and actionsDataTablePagination- Full-featured pagination controlsDataTableSearchFilter- Global search input with debouncingDataTableFilterMenu- Command palette-style filter interfaceDataTableFacetedFilter- Faceted filter for single/multiple selectionDataTableSortMenu- Sort management with drag-and-dropDataTableViewMenu- Column visibility toggleDataTableInlineFilter- Inline filter toolbarDataTableSliderFilter- Slider filter for numeric rangesDataTableDateFilter- Date filter componentDataTableClearFilter- Clear all filters buttonDataTableExportButton- Export to CSV buttonDataTableColumnHeader- Sortable column headerDataTableColumnFacetedFilterMenu- Column-level faceted filter popoverDataTableColumnSliderFilterMenu- Column-level slider filter popoverDataTableColumnDateFilterMenu- Column-level date filter popoverDataTableAside- Sidebar componentDataTableSelectionBar- Bulk actions barDataTableEmptyState- Empty state composition components
Core filter implementation components that accept a table prop directly. They are used internally by the context-aware components but can also be used standalone when building custom components.
Components:
TableSearchFilter- Core search filterTablePagination- Core paginationTableFilterMenu- Core filter menuTableFacetedFilter- Core faceted filterTableSliderFilter- Core slider filterTableDateFilter- Core date filterTableSortMenu- Core sort menuTableViewMenu- Core view menuTableInlineFilter- Core inline filterTableClearFilter- Core clear filterTableExportButton- Core export buttonTableRangeFilter- Core range filter
Custom React hooks for table functionality.
Hooks:
useDataTable- Access table instance and contextuseDebounce- Debounce values for search/filtersuseDerivedColumnTitle- Derive column titlesuseGeneratedOptions- Generate filter options from datauseKeyboardShortcut- Manage keyboard shortcuts
Credits and Inspirations
Section titled “Credits and Inspirations”Niko Table is built on top of excellent open-source projects and inspired by the work of talented developers in the community.
Core Dependencies
Section titled “Core Dependencies”-
TanStack Table by Tanner Linsley - The headless table library that powers everything. Provides the foundation for all table functionality including sorting, filtering, pagination, and more.
-
Shadcn UI by Shadcn - Beautiful, accessible component primitives built on Radix UI. All UI components in Niko Table are built using Shadcn UI components.
Major Inspirations
Section titled “Major Inspirations”-
sadmann7’s work - Major inspiration for filter components and table patterns:
- TableCN - Inspired our filter menu, inline filter, faceted filter, and slider filter implementations. The composition pattern and filter architecture drew heavily from this excellent project.
- DiceUI Sortable - Drag and drop sortable for row reordering, which inspired the sort menu implementation.
-
nuqs by François Best - Type-safe search params state manager for URL state management. Used in server-side examples for managing table state in URLs.
-
Web Dev Simplified Registry by Kyle Cook - Registry implementation pattern that inspired the structure and organization of this project.
Philosophy
Section titled “Philosophy”Following the Shadcn philosophy: “Nobody’s table, everyone’s solution.”
- Copy and paste the code into your project
- Own the code - modify it as needed
- No dependencies on external packages (except TanStack Table and Shadcn UI)
- Fully customizable and themeable
- Built with TypeScript for type safety
License
Section titled “License”MIT License - use it freely in your projects!