Data

Table workflows.

Selection, filters, visible columns and bulk actions, working together.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/advanced-table.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

Select and act on local records

Column controls and bulk actions operate on a complete in-memory dataset.

Loads this example when you need it.

Keyboard

  • Tab reaches selection and column controls.
  • Space changes row selection; the bulk action removes selected local rows.

States covered

  • Unselected
  • Selected
  • Bulk action
  • Column visibility

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-basic-advanced-table.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import {useState} from 'react';
import {Button,DataTable,UIProvider,type Column} from '@bld8/ui';
import '@bld8/ui/styles.css';
type Row={id:string;name:string;status:string};
const columns:Column<Row>[]=[{key:'name',header:'Name',cell:row=>row.name,sortValue:row=>row.name},{key:'status',header:'Status',cell:row=>row.status,sortValue:row=>row.status}];
export default function BulkTableExample(){const [rows,setRows]=useState<Row[]>([{id:'one',name:'Example review',status:'Active'},{id:'two',name:'Example notes',status:'Draft'}]),[selected,setSelected]=useState<string[]>([]);return <UIProvider><DataTable caption="Example local projects" rows={rows} columns={columns} rowKey={row=>row.id} rowLabel={row=>row.name} selectable selectedKeys={selected} onSelectedKeysChange={setSelected} columnVisibility searchText={row=>row.name} renderBulkActions={records=><Button onClick={()=>{setRows(current=>current.filter(row=>!records.some(record=>record.id===row.id)));setSelected([]);}}>Remove selected example rows</Button>}/></UIProvider>;}

Quick reference

React / TypeScript
<DataTable caption="Projects" rows={rows} columns={columns}
  rowKey={row=>row.id} rowLabel={row=>row.name} selectable
  selectedKeys={selected} onSelectedKeysChange={setSelected}
  columnVisibility density="compact" filters={filters}
  renderBulkActions={rows=><Button onClick={()=>archive(rows)}>Archive</Button>} />

In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.

API & behaviour

Try column ordering and row-save recovery · Saved layout guide

Extends the existing client-side DataTable API. Selection persists across search/pages; the header selects only the current page and shows mixed state. filters supply scalar values/options. hideable:false keeps a column visible; visibleColumnKeys/onVisibleColumnKeysChange can control visibility. Loading, error/onRetry and compact density are optional. createTableCSV exports explicit exportValue/sortValue scalars with CSV quoting and formula escaping. Use server={query,onQueryChange,totalRows} for externally fetched rows; the table skips client filtering/slicing. renderSelectedActions receives stable keys across pages. resizableColumns enables pointer and keyboard resizing; columns accept width, minWidth and pinned:start/end. Optional grouping covers all locally filtered records; server grouping describes the supplied page. reorderableColumns adds keyboard position controls to the Columns menu. SortableDataTable opts into pointer/touch dragging with the same props, keeping drag dependencies out of ordinary tables. Install /r/sortable-table.json for that wrapper, then import SortableDataTable from the installed bld8/sortable-table source. Control columnOrderKeys, columnWidths and columnPinning to save a layout with table-view-state. onRowMove reports stable row/target keys for the host to save and apply; manual row moves are disabled while sorting, searching, filtering, grouping or using a service query. See /examples/table-ordering. WindowedTable provides a separate bounded scrolling view for display rows and external detail dialogs.

DataTable

DataTable public properties
PropTypeDefault
captionRequiredstring—
columnsRequiredColumn<T>[]—
rowKeyRequired(row: T) => string—
rowsRequiredT[]—
collapsedGroupKeysstring[] | undefined—
columnOrderKeysstring[] | undefined—
columnPinningRecord<string, "start" | "end"> | undefined—
columnVisibilityboolean | undefinedfalse
columnWidthsRecord<string, number> | undefined—
defaultCollapsedGroupKeysstring[] | undefined[]
defaultColumnOrderKeysstring[] | undefined—
defaultColumnWidthsRecord<string, number> | undefined{}
defaultSelectedKeysstring[] | undefined[]
defaultVisibleColumnKeysstring[] | undefined—
density"compact" | "comfortable" | undefined'comfortable'
emptyStateReactNode

Custom empty feedback for composed filter workflows.

—
errorstring | undefined—
filtersTableFilter<T>[] | undefined[]
groupingTableGrouping<T> | undefined

Client groups cover the filtered dataset; server groups describe only the supplied page.

—
loadingboolean | undefined—
multiSortboolean | undefined

Shift-select a column heading to add up to five ordered sort criteria.

false
onCollapsedGroupKeysChange((keys: string[]) => void) | undefined—
onColumnOrderKeysChange((keys: string[]) => void) | undefined—
onColumnWidthsChange((widths: Record<string, number>) => void) | undefined—
onRetry(() => void) | undefined—
onRowMove((move: TableRowMove) => void | Promise<void>) | undefined

Manual moves require an unfiltered, unsorted client table. The host saves and applies the order.

—
onSelectedKeysChange((keys: string[]) => void) | undefined—
onVisibleColumnKeysChange((keys: string[]) => void) | undefined—
pageSizenumber | undefined5
renderBulkActions((selectedRows: T[]) => ReactNode) | undefined—
renderSelectedActions((keys: string[]) => ReactNode) | undefined—
reorderableColumnsboolean | undefined

Reorder every column in the Columns menu, including hidden columns.

false
resizableColumnsboolean | undefinedfalse
rowLabel((row: T) => string) | undefinedrowKey
searchText((row: T) => string) | undefined—
selectableboolean | undefinedfalse
selectedKeysstring[] | undefined—
server{ query: TableQuery; onQueryChange: (query: TableQuery) => void; totalRows: number; } | undefined—
viewOptionsReactNode

Additional view controls inside the Columns popover.

—
visibleColumnKeysstring[] | undefined—

SortableDataTable

SortableDataTable public properties
PropTypeDefault
captionRequiredstring—
columnsRequiredColumn<T>[]—
rowKeyRequired(row: T) => string—
rowsRequiredT[]—
collapsedGroupKeysstring[] | undefined—
columnOrderKeysstring[] | undefined—
columnPinningRecord<string, "start" | "end"> | undefined—
columnVisibilityboolean | undefined—
columnWidthsRecord<string, number> | undefined—
defaultCollapsedGroupKeysstring[] | undefined—
defaultColumnOrderKeysstring[] | undefined—
defaultColumnWidthsRecord<string, number> | undefined—
defaultSelectedKeysstring[] | undefined—
defaultVisibleColumnKeysstring[] | undefined—
density"compact" | "comfortable" | undefined—
emptyStateReactNode

Custom empty feedback for composed filter workflows.

—
errorstring | undefined—
filtersTableFilter<T>[] | undefined—
groupingTableGrouping<T> | undefined

Client groups cover the filtered dataset; server groups describe only the supplied page.

—
loadingboolean | undefined—
multiSortboolean | undefined

Shift-select a column heading to add up to five ordered sort criteria.

—
onCollapsedGroupKeysChange((keys: string[]) => void) | undefined—
onColumnOrderKeysChange((keys: string[]) => void) | undefined—
onColumnWidthsChange((widths: Record<string, number>) => void) | undefined—
onRetry(() => void) | undefined—
onRowMove((move: TableRowMove) => void | Promise<void>) | undefined

Manual moves require an unfiltered, unsorted client table. The host saves and applies the order.

—
onSelectedKeysChange((keys: string[]) => void) | undefined—
onVisibleColumnKeysChange((keys: string[]) => void) | undefined—
pageSizenumber | undefined—
renderBulkActions((selectedRows: T[]) => ReactNode) | undefined—
renderSelectedActions((keys: string[]) => ReactNode) | undefined—
reorderableColumnsboolean | undefined

Reorder every column in the Columns menu, including hidden columns.

—
resizableColumnsboolean | undefined—
rowLabel((row: T) => string) | undefined—
searchText((row: T) => string) | undefined—
selectableboolean | undefined—
selectedKeysstring[] | undefined—
server{ query: TableQuery; onQueryChange: (query: TableQuery) => void; totalRows: number; } | undefined—
viewOptionsReactNode

Additional view controls inside the Columns popover.

—
visibleColumnKeysstring[] | undefined—

Column

Column public properties
PropTypeDefault
cellRequired(row: T) => ReactNode—
headerRequiredstring—
keyRequiredstring—
align"center" | "start" | "end" | undefined—
exportValue((row: T) => string | number) | undefined—
flexnumber | undefined

Extra available width is assigned to flexible columns.

—
hideableboolean | undefined—
minWidthnumber | undefined—
pinned"start" | "end" | undefined—
resizableboolean | undefined—
sortValue((row: T) => string | number) | undefined—
widthnumber | undefined—

TableQuery

TableQuery public properties
PropTypeDefault
filtersRequiredRecord<string, string>—
pageRequirednumber—
pageSizeRequirednumber—
searchRequiredstring—
sortRequiredTableSort | null—
sortsTableSort[] | undefined

Optional ordered multi-sort. When supplied, sort mirrors its first item.

—

TableFilter

TableFilter public properties
PropTypeDefault
keyRequiredstring—
labelRequiredstring—
optionsRequired{ value: string; label: string; }[]—
valueRequired(row: T) => string—

TableGrouping

TableGrouping public properties
PropTypeDefault
keyRequired(row: T) => string—
labelRequired(key: string) => string—

TableRowMove

TableRowMove public properties
PropTypeDefault
positionRequired"before" | "after"—
rowKeyRequiredstring—
targetKeyRequiredstring—

TableViewState

TableViewState public properties
PropTypeDefault
columnOrderKeysRequiredstring[]—
columnPinningRequiredRecord<string, "start" | "end">—
columnWidthsRequiredRecord<string, number>—
densityRequired"compact" | "comfortable"—
queryRequiredOmit<TableQuery, "page">—
versionRequired1—
visibleColumnKeysRequiredstring[]—

TableViewOptions

TableViewOptions public properties
PropTypeDefault
columnsRequiredreadonly TableViewColumn[]—
filterKeysreadonly string[] | undefined

Facet keys accepted by the host. Unknown facets are dropped on restoration.

—
pageSizesreadonly number[] | undefined

Defaults to 5, 10, 20, 50 and 100. The first value is the initial page size.

—

Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.

Related controls

Notes to self

Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.