DataTable

A table built on TanStack Table, with filter chips, a filter drawer, a column panel, header menus, pinning, row selection and CSV export.

LLMs

Basic

Pass columns and data to useDataTable, then the table it returns to DataTable, which sorts and pages in the browser.

Filter chips

Set filter.chip in a column's meta for a toolbar chip: a list with counts for select and multi-select, a slider with its unit for range.

Date chips

A date column's chip opens a calendar for one day, and a date-range column's chip picks a start and an end and keeps the stays that overlap them.

Filter drawer

Give columns a variant and the Filters button opens a drawer with an operator and a value per column, here from the start with placement.

Chip and drawer together

A column with a chip is in the drawer too, and both edit the same filter, so the Pending status set in initialState shows in each.

Header menu

Each header opens a menu to sort, pin to the start or end, move the column or hide it, and meta.tooltip adds a hint beside the label.

Column panel

The View button lists the columns to show, hide and drag into a new order, and meta.panelLocked keeps Name visible and in place.

Row selection

Add getSelectColumn() and pass actionBar for the selected rows' actions, and set actionBarProps.container to "window" to fix the bar to the bottom of the window.

Single selection

Call getSelectColumn({ mode: "single" }) and set enableMultiRowSelection to false for a radio per row, like picking one rate.

Row actions

Add getActionsColumn() with the menu items for each row, where Edit opens the guest in a drawer and Delete removes the row.

Pinning and resizing

Set columnPinning in initialState to keep Booking at the start and Total at the end while the rest scrolls, and drag a header edge to resize.

Size

Set size to small, medium or large for the row height, the same three as Table.

Server mode

Set mode to server with a rowCount, fetch each page from the controlled paging, sorting, filters and search, and show loading while it arrives.

Applied filters

Pass onFiltersChange to the toolbar to get the applied filters with their labels, here shown as closable tags above the table.

CSV export

Call exportCsv with a scope to download all matching rows, the current page or the selected rows as a CSV file.

Empty, loading and skeleton

A table with no rows shows an empty state, loading puts a spinner over the rows, and DataTableSkeleton stands in for the first load.

In context

The component inside real screens, with the components it usually sits beside.

Room types

A room types list with a name search, meal plan tags, capacity columns with their own icon, row actions and pagination.

Payment methods

A payment methods list under a warning, with Visibility, Provider and Status chips, colored visibility tags and status dots.