<DataTable />

<DataTable <T> />TailwindCSS ModulesProduction Stable

Enterprise-grade data table for operational dashboards: unified client and server query protocols, toolbar search and thirteen filter types, multi-column sort, pagination, row selection, column visibility, expandable rows, and dual list/grid layouts — all driven by a single DataTableQuery object.

InstallationColoxo CLI
npx coloxo add data-table --style coloxo-css
ES Module ImportPlayground / npm package
import { DataTable, type DataTableColumn, type DataTableQuery } from '@coloxo/ui';

Design Tokens:

--cx-datatable-row-height--cx-datatable-header-height--cx-datatable-border--cx-datatable-active-bg

01 / Architecture & pipeline

1. Client vs Server Query Engine

Two execution models share identical toolbar UX and query shape; only the data plane differs.

In-Memory Engine (client)DEFAULT
Runs applyClientPipeline locally: search → filter → sort → paginate over the in-memory data array.

Ideal for admin consoles under ~5k rows, Storybook demos, and offline-first tooling.

mode="client" (default)
onQueryChange updates UI state only
Controlled Query Protocol (server)
Parent owns fetching; pass total, loading, and current page slice via data.

Query mutations mirror REST/GraphQL list endpoints and URL-serialized filter state.

mode="server"
query={query}
onQueryChange={setQuery}
total={remoteTotal}

Client pipeline stages

  1. STAGE 01

    Search

    Global + per-field text match

  2. STAGE 02

    Filter

    Column operators (eq, in, between…)

  3. STAGE 03

    Sort

    Single or multi field ordering

  4. STAGE 04

    Paginate

    page × pageSize window

  5. STAGE 05

    Render

    List table or grid cards

Page reset contract: DEFAULT_RESET_PAGE_ON resets to page 1 when search, filter, pageSize, or sort changes unless overridden via resetPageOn.

02 / Column configuration

2. Column Schema & Render Patterns

Declarative column definitions map query fields to cells, filters, and sticky layout.

NameTypeDefaultDescription
keystring—Stable column id for sort/filter field mapping and visibility toggles.
titleReactNode | fn—Header label or render function receiving the column definition.
dataIndexkeyof T | string | string[]—Field accessor; supports nested paths like network.ingress.ip.
width / minWidthnumber | string—Fixed or minimum column width for table-layout: fixed.
sortableboolean | { multi?, compare? }—Enables sort control; optional compare(a,b) overrides default value ordering.
filterDataTableColumnFilter—Toolbar filter popover config (type, options, applyMode, custom render).
render(value, record, index) => ReactNode—Cell renderer when raw dataIndex value is not enough.
align"left" | "center" | "right"—Cell and header text alignment.
fixed"left" | "right"—Sticky column pinning for wide datasets.
hiddenboolean—Exclude column from initial render (visibility API can still toggle).
Numeric right align
Financial amounts use tabular nums and right alignment for scanability.

128,450.22 USD

align="right"
sortable={{ compare: (a,b) => a.amount - b.amount }}
Fixed right actions
Pin trailing controls while horizontally scrolling wide datasets.
fixed="right"
rowActions={(record) => <RowActions />}
Status badges
Map enum values to semantic Badge colors inside render().
Active
render={(value) => (
  <Badge color={mapStatus(value)} dot />
)}

03 / Filtering & query helpers

3. Filters, Sorting & Query Utilities

Thirteen first-class filter types plus immutable query merge helpers and URL serialization.

textselectmulti-selectcheckboxradiodatedate-rangenumbernumber-rangebooleansearch-selecttree-selectcustom
mergeQuery(base, patch)

Shallow-merge a partial query patch without resetting pagination unless intended.

withPageReset(prev, patch, resetOn?)

Applies patch and forces page: 1 when search, filter, pageSize, or sort changes per resetOn / DEFAULT_RESET_PAGE_ON.

applyClientPipeline(data, columns, query)

Runs the full in-memory pipeline; returns { rows, total } for client mode previews.

import {
  applyClientPipeline,
  mergeQuery,
  withPageReset,
  DEFAULT_RESET_PAGE_ON,
  parseDataTableQuery,
  serializeDataTableQuery,
  serializeDataTableQueryToURLSearchParams,
} from '@coloxo/ui';

const next = withPageReset(query, { search: 'acme' }, DEFAULT_RESET_PAGE_ON);
const { rows, total } = applyClientPipeline(data, columns, next);
const params = serializeDataTableQueryToURLSearchParams(next);
const restored = parseDataTableQuery(params);

04 / Live sandbox

4. Interactive Live Sandbox & Inspector

Tune density, view mode, and toolbar features; copy generated JSX for your app shell.

Props inspector

Visual Render CanvasLIST · STANDARD
Team directory sandbox
ActionsDepartmentEmailStatus

Member 1

MBR-0001

EngineeringManagermember1@coloxo.appActive2024-01-01

Member 2

MBR-0002

DesignIndividual contributormember2@coloxo.appPending2024-02-02

Member 3

MBR-0003

HRIndividual contributormember3@coloxo.appInactive2024-03-03

Member 4

MBR-0004

FinanceManagermember4@coloxo.appActive2024-04-04

Member 5

MBR-0005

EngineeringIndividual contributormember5@coloxo.appPending2024-05-05

Member 6

MBR-0006

DesignIndividual contributormember6@coloxo.appInactive2024-06-06

Member 7

MBR-0007

HRManagermember7@coloxo.appActive2024-07-07

Member 8

MBR-0008

FinanceIndividual contributormember8@coloxo.appPending2024-08-08
tsx
<DataTable  columns={columns}  data={rows}  search={{ placeholder: 'Search members…', debounceMs: 300 }}  pagination={{ pageSize: 8, showSizeChanger: true }}  rowSelection={{}}  stickyHeader/>

05 / Dual view modes

5. List vs Grid Layout

Same query state powers native table semantics or card grid density.

List view

DepartmentEmailStatus

Member 1

MBR-0001

EngineeringManagermember1@coloxo.appActive2024-01-01

Member 2

MBR-0002

DesignIndividual contributormember2@coloxo.appPending2024-02-02

Member 3

MBR-0003

HRIndividual contributormember3@coloxo.appInactive2024-03-03

Member 4

MBR-0004

FinanceManagermember4@coloxo.appActive2024-04-04

Member 5

MBR-0005

EngineeringIndividual contributormember5@coloxo.appPending2024-05-05

Member 6

MBR-0006

DesignIndividual contributormember6@coloxo.appInactive2024-06-06

Grid view

Active
Member 1
MBR-0001
Manager · Engineering
Pending
Member 2
MBR-0002
Individual contributor · Design
Inactive
Member 3
MBR-0003
Individual contributor · HR
Active
Member 4
MBR-0004
Manager · Finance
Pending
Member 5
MBR-0005
Individual contributor · Engineering
Inactive
Member 6
MBR-0006
Individual contributor · Design

06 / Enterprise dark theme

6. Dark Theme Matrix

Token-driven borders and active row fills on deep enterprise surfaces.

Incident audit trail · compact density
Row height 32px · header 44px · --cx-datatable-border on #0B1120
Security operations log
Recent audit events
SeverityIncidentServiceActorTimestamp
CRITICALINC-9021auth-gatewaysvc-bot-iam2026-09-22 14:02 UTC
HIGHINC-9020payments-apijordan.vance2026-09-22 13:48 UTC
MEDIUMINC-9019search-indexdeploy-hook2026-09-22 13:12 UTC
HIGHINC-9018ledger-writerbatch-recon2026-09-22 12:55 UTC

07 / Enterprise compositions

7. High-Density Application Patterns

Selection-aware ledgers and expandable infrastructure rows in production layouts.

Composition A: Financial ledger

Treasury

Row selection with live selected count for batch approval workflows.

0 rows selected

CounterpartyStatus
SWIFT-88421Acme Treasury Ltd.128,450.22 USDposted
ACH-44102Northwind Payroll-42,800.00 USDposted
WIRE-99201Helios Capital510,000.00 EURpending
ACH-44188Vertex Cloud-9,240.15 USDfailed
SWIFT-88425Orbital FX Desk76,320.50 GBPposted

Composition B: Kubernetes pods

Platform

Expandable rows surface container metrics without leaving the list context.

NamespaceNodePhaseRestarts
api-gateway-7f9c8prod-edgegke-node-12Running0
billing-worker-2a1prod-billinggke-node-04Running1

CPU

180m

Memory

768Mi

Node

gke-node-04

search-index-0prod-searchgke-node-09Pending0
metrics-scraper-failobservabilitygke-node-02Failed5

08 / Accessibility contract

8. Keyboard & Assistive Technology

Native table semantics, sort affordances, and stable layout under hydration.

Keyboard navigation

Tab through toolbar controls; sort buttons activate with Enter/Space; row selection checkboxes participate in the tab order with visible focus rings.

aria-sort & live regions

Sortable headers expose aria-sort (ascending/descending/none). Pagination and selection summaries use polite live regions where counts change.

table-layout: fixed & CLS

Explicit column widths and --cx-datatable-row-height via data-density keep cumulative layout shift at zero during SSR hydration and density toggles.

Props

NameTypeDefaultDescription
columnsDataTableColumn<T>[]—Column definitions (key, title, dataIndex, sortable, filter, render, align, fixed).
dataT[]—Row records for the current view or server page slice.
mode"client" | "server"clientClient pipeline vs parent-owned server fetching.
query / defaultQueryDataTableQuery / Partial<DataTableQuery>—Controlled or initial paging, search, sort, and filters.
onQueryChange(query: DataTableQuery) => void—Fired when toolbar interactions mutate query state.
totalnumber—Remote row count (server mode).
loadingboolean—Shows loading affordance over the table body.
errorboolean | Error | ReactNode—Error state surface.
searchboolean | DataTableSearchConfig—Global search field (placeholder, debounceMs, fields).
paginationboolean | DataTablePaginationConfig—Footer paging controls and page size changer.
resetPageOnDataTableResetPageOn—When to reset to page 1 (defaults to DEFAULT_RESET_PAGE_ON).
rowSelectionDataTableRowSelection<T>—Checkbox selection with optional controlled selectedRowKeys.
columnVisibilityboolean | DataTableColumnVisibility—Column show/hide toggles in the toolbar.
expandableDataTableExpandable<T>—Expandable rows with renderExpandedRow.
viewMode / defaultViewMode"list" | "grid"—Layout; grid requires renderGridItem.
renderGridItem(record, index) => ReactNode—Card renderer for grid view.
stickyHeaderboolean—Sticky header row while scrolling.
rowDensity"compact" | "standard" | "comfortable"standardRow rhythm via data-density and --cx-datatable-row-height (32 / 40 / 48).
rowActions(record, index) => ReactNode—Trailing actions column (often fixed right).
captionstring—Accessible table caption.
getRowId(record, index) => string—Stable row key resolver.