niko-table-best-practices
Niko Table Integration Guide
A skill for building and configuring data tables with Niko Table: structure, filters (search, faceted, advanced), column menus, DnD, server-side patterns, and the editable Data Grid.
At a high level:
- New table: DataTableRoot → ToolbarSection (optional) → DataTable → Header + Body (Skeleton, EmptyBody) → Pagination. Use direct file imports only (no barrel exports).
- Adding filters: Toolbar = DataTableSearchFilter, DataTableFacetedFilter, DataTableFilterMenu. Column headers = DataTableColumnFacetedFilterMenu, DataTableColumnSliderFilterMenu, DataTableColumnDateFilterMenu. Set column
meta(variant, options, etc.) andenableColumnFilter: true. - Row/column DnD: Row DnD needs
getRowId, DataTableRowDndProvider outside DataTable; don’t combine row DnD with sorting/filtering. Column DnD is safe with everything. - Server-side:
config.manualPagination/manualSorting/manualFiltering+config.pageCount, passtotalCountto DataTablePagination, and setmaxHeightonDataTableso page-size changes scroll. Structure it around a serializable wire contract — ONE functionfetch(query: { page, pageSize, sorting, search, columnFilters })→{ data, total, facets }— so any backend (SQL, Drizzle, Prisma, Supabase, REST) plugs in; see Server-Side Table example and the Drizzle ORM guide at niko-table.com. - URL state (nuqs): Wrap app with
NuqsAdapter; useuseQueryStateswith parsers for pagination, sort, filters, search; pass URL-derived state intoDataTableRootand wireonPaginationChange/onSortingChange/onColumnFiltersChange/onGlobalFilterChangetosetUrlParams. - Large lists: Use
DataTableVirtualizedBody(from core/structure) instead ofDataTableBodyfor 10k+ rows; same children (Skeleton, EmptyBody). See Virtualization Table example. - Sidebar: Use
DataTableAside(and trigger) for a detail panel next to the table. See Aside Table example. - Data Grid:
useDataGrid+<DataGrid grid={grid}>wrappingDataTableinsideDataTableRoot. Opt-in children for clipboard/fill/move. Cell editors via<DataGridCell>+Grid*Cell. Install@niko-table/data-table-grid(+data-table-grid-changesfor persistence). Mount<DataTableColumnResize />inside the grid so columns flex-fill the width, and passclassName="space-y-2 outline-none"to<DataGrid>for spacing. For grids backed by a server, don't paginate — stream chunks on scroll (see Server-Side patterns below). See Basic Grid / Data Grid docs on niko-table.com.
Your job when using this skill is to figure out where the user is — new table, adding filters/DnD, fixing imports, wiring server-side, URL state (nuqs), row expansion, tree table, row selection, or editable Data Grid — and give them the right structure, imports, and patterns. If they’re vague (“I want a table”), suggest the minimal template and point to niko-table.com for examples. If they already have a table and want faceted filters or the advanced filter menu, jump to the Filtering section. If they want spreadsheet editing, go to Data Grid. Stay flexible: some users want copy-paste snippets; others want to understand the two-layer (DataTable* vs Table*) pattern.
Full docs and examples: https://niko-table.com. Registry: https://niko-table.com/r/{name}.json in components.json under registries["@niko-table"].