Table

Data Table

index.tsx

Install

$ bunx --bun shadcn add @beui/table

Editable Table

index.tsx

Install

$ bunx --bun shadcn add @beui/table-editable

Async Table

index.tsx

Install

$ bunx --bun shadcn add @beui/table-async

API Reference

data
T[]
Default—
columns
TableColumn<T>[]
Default—
getRowId?
((row: T, index: number) => string)

Stable id per row, required for correct selection across sorts. Defaults to row index.

Default—
selectable?
boolean

Render a leading checkbox column with select-all in the header.

Defaultfalse
selectedRowIds?
string[]
Default—
defaultSelectedRowIds?
string[]
Default—
onSelectionChange?
((ids: string[]) => void)
Default—
sort?
SortState | null
Default—
defaultSort?
SortState | null
Defaultnull
onSortChange?
((sort: SortState | null) => void)
Default—
resizable?
boolean

Allow dragging the right edge of a header to resize that column.

Defaultfalse
minColumnWidth?
number

Minimum column width in px when resizing.

Default64
onColumnResize?
((key: string, width: number) => void)
Default—
reorderable?
boolean

Allow dragging a header grip to reorder columns.

Defaultfalse
onColumnOrderChange?
((keys: string[]) => void)
Default—
onCellEdit?
((rowId: string, columnKey: string, value: string) => void)

Called when an `editable` cell changes.

Default—
onColumnRename?
((columnKey: string, value: string) => void)

When set, non-sortable headers become editable inputs for the column name.

Default—
onInsertRow?
((index: number, position: InsertPosition) => void)

Enables the row menu (Insert before / after). Receives the target index.

Default—
onDeleteRow?
((rowId: string, index: number) => void)

Enables Delete in the row menu.

Default—
onInsertColumn?
((index: number, position: InsertPosition) => void)

Enables the column menu (Insert before / after). Receives the target column index.

Default—
onDeleteColumn?
((columnKey: string, index: number) => void)

Enables Delete in the column menu.

Default—
rowHeight?
number

Fixed row height in px — required for virtualization.

Default48
height?
number

Scroll viewport height in px.

Default440
overscan?
number

Rows rendered above/below the viewport.

Default10
onEndReached?
(() => void)

Fires when the viewport scrolls near the bottom — load the next page.

Default—
loading?
boolean

Currently fetching — shows skeleton rows and pauses `onEndReached`.

Defaultfalse
skeletonRows?
number

How many skeleton rows to show while loading more (default 3).

Default3
emptyState?
ReactNode
Default—
labels?
Partial<{ empty: string; selectAll: string; selectRow: string; cellLabel: string; cellPlaceholder: string; columnOptions: string; reorderColumn: string; renameColumn: string; resizeColumn: string; ... 4 more ...; deleteRow: string; }>

Override any built-in string. `{row}` and `{column}` fill the per-row and per-column labels.

Default—
className?
string
Default—

Updated