Data Grid

Virtualized table with resizable columns, selection, and optional cell editing.

Also known as: table, grid, spreadsheet, virtual table

Installation

Install with the CLI, or copy the component source into your project.

Add data-grid (npm)

npx --yes -p github:itsvigneshv/default-file-ui#main df-ui add data-grid

Properties

Virtualized data table with resizable columns, row selection, and optional cell editing.

DataGrid

PropTypeDefaultNotes
rowsDataGridRow<T>[]-Row models with id and data (required).
columnsDataGridColumnDef<T>[]-Column definitions (required).
columnStateDataGridColumnState[]-Controlled column width and visibility state.
defaultColumnStateDataGridColumnState[]-Uncontrolled initial column state.
onColumnStateChange(state: DataGridColumnState[]) => void-Called when column widths or visibility change.
selectionMode"none" | "single" | "multiple"-Row selection behavior.
selectedIdsstring[]-Controlled selected row ids.
defaultSelectedIdsstring[]-Uncontrolled initial selected row ids.
onSelectionChange(ids: string[]) => void-Called when selection changes.
loadingbooleanfalseShow loading placeholder rows.
emptyContentReactNode-Content when there are no rows.
overscannumber-Extra virtual rows rendered outside the viewport.
estimateRowSizenumber-Estimated row height in pixels for virtualization.
classNamestring-Additional styles on the root.

DataGridColumnDef

PropTypeDefaultNotes
idstring-Stable column id (required).
headerReactNode-Header cell content (required).
widthnumber-Initial width in pixels.
minWidthnumber-Lower bound for resize. Defaults to --df-data-grid-col-min-width.
maxWidthnumber-Upper bound for resize. Defaults to --df-data-grid-col-max-width.
resizableboolean-When true, the column can be resized.
hiddenboolean-When true, the column is omitted from the grid.
cell(row: DataGridRow<T>) => ReactNode-Render function for the body cell (required).
editCell(row, commit) => ReactNode-Optional editor for the cell.