DataGrid
DataGrid Component
Playground
Name
Email
Status
Role
Amount
John Doe
john.doe@example.com
Active
Admin
4447.82
Jane Doe
jane.doe@example.com
Pending
User
3524.81
Bob Doe
bob.doe@example.com
Inactive
Viewer
145.27
Alice Doe
alice.doe@example.com
Active
Editor
1869.82
Charlie Doe
charlie.doe@example.com
Pending
Manager
2110.61
Diana Doe
diana.doe@example.com
Inactive
Admin
478.18
Edward Doe
edward.doe@example.com
Active
User
1955.95
Fiona Doe
fiona.doe@example.com
Pending
Viewer
4760.7
George Doe
george.doe@example.com
Inactive
Editor
2224.33
Hannah Doe
hannah.doe@example.com
Active
Manager
1641.24
Props
| Prop | Type | Default | Value |
|---|---|---|---|
data* | T[] | — | — |
columns* | DataGridColumnDef<T>[] | — | — |
getRowId* | (row: T, index: number) => string | — | — |
variant | 'default' | 'bordered' | 'striped' | 'card' | — | |
density | 'condensed' | 'regular' | 'relaxed' | — | |
rowDivider | 'line' | 'none' | — | |
striped | boolean | — | |
hoverable | boolean | — | |
selectable | boolean | — | |
multiSelect | boolean | — | |
selectedRowIds | Set<string> | — | |
expandedRowIds | Set<string> | — | |
stickyHeader | boolean | — | |
showCheckbox | boolean | — | |
sortState | DataGridSortState | null | — | — |
emptyState | ReactNode | — | — |
loading | boolean | — | |
loadingRowCount | number | — | |
rowEventHandlers | DataGridRowEventHandlers<T> | — | — |
onSort | (state: DataGridSortState) => void | — | — |
onSelectionChange | (selectedIds: Set<string>) => void | — | — |
renderExpandedRow | (row: DataGridRowData<T>) => ReactNode | — | — |
rowClassName | string | ((row: DataGridRowData<T>) => string) | — | — |
rowStyle | CSSProperties | ((row: DataGridRowData<T>) => CSSProperties) | — | — |
caption | ReactNode | — | — |
clientSideSort | boolean | — | |
sortFn | (a: T, b: T, columnId: string, direction: 'asc' | 'desc') => number | — | — |
virtualScroll | boolean | — | |
height | number | string | — | |
estimatedRowHeight | number | — | |
overscan | number | — | |
showScrollMask | boolean | — | |
maskHeight | number | — | |
maskTopHeight | number | — | |
maskFadeDistance | number | — | |
showToolbar | boolean | — | |
searchValue | string | — | |
searchPlaceholder | string | — | |
onSearch | (value: string) => void | — | — |
showColumnManager | boolean | — | |
onColumnVisibilityChange | (columnId: string, visible: boolean) => void | — | — |
onColumnOrderChange | (columnIds: string[]) => void | — | — |
toolbarActions | ReactNode | — | — |
toolbarContent | ReactNode | — | — |
Related Components
DataGridCheckboxDataGridHeaderCellDataGridCellDataGridRow
Usage
const columns = [
{ id: 'name', header: 'Name', accessor: 'name', sortable: true },
{ id: 'email', header: 'Email', accessor: 'email' },
{ id: 'amount', header: 'Amount', accessor: 'amount', numeric: true },
];
<DataGrid
data={users}
columns={columns}
getRowId={(row) => row.id}
selectable
showCheckbox
hoverable
onSort={(state) => console.log('Sort:', state)}
rowEventHandlers={{
onRowClick: (row) => console.log('Clicked:', row),
}}
/>Variants
Style Variants
Name
Email
Status
Role
Amount
John Doe
john.doe@example.com
Active
Admin
4447.82
Jane Doe
jane.doe@example.com
Pending
User
3524.81
Bob Doe
bob.doe@example.com
Inactive
Viewer
145.27
Alice Doe
alice.doe@example.com
Active
Editor
1869.82
Charlie Doe
charlie.doe@example.com
Pending
Manager
2110.61
Diana Doe
diana.doe@example.com
Inactive
Admin
478.18
Edward Doe
edward.doe@example.com
Active
User
1955.95
Fiona Doe
fiona.doe@example.com
Pending
Viewer
4760.7
George Doe
george.doe@example.com
Inactive
Editor
2224.33
Hannah Doe
hannah.doe@example.com
Active
Manager
1641.24
Name
Email
Status
Role
Amount
John Doe
john.doe@example.com
Active
Admin
4447.82
Jane Doe
jane.doe@example.com
Pending
User
3524.81
Bob Doe
bob.doe@example.com
Inactive
Viewer
145.27
Alice Doe
alice.doe@example.com
Active
Editor
1869.82
Charlie Doe
charlie.doe@example.com
Pending
Manager
2110.61
Diana Doe
diana.doe@example.com
Inactive
Admin
478.18
Edward Doe
edward.doe@example.com
Active
User
1955.95
Fiona Doe
fiona.doe@example.com
Pending
Viewer
4760.7
George Doe
george.doe@example.com
Inactive
Editor
2224.33
Hannah Doe
hannah.doe@example.com
Active
Manager
1641.24
Name
Email
Status
Role
Amount
John Doe
john.doe@example.com
Active
Admin
4447.82
Jane Doe
jane.doe@example.com
Pending
User
3524.81
Bob Doe
bob.doe@example.com
Inactive
Viewer
145.27
Alice Doe
alice.doe@example.com
Active
Editor
1869.82
Charlie Doe
charlie.doe@example.com
Pending
Manager
2110.61
Diana Doe
diana.doe@example.com
Inactive
Admin
478.18
Edward Doe
edward.doe@example.com
Active
User
1955.95
Fiona Doe
fiona.doe@example.com
Pending
Viewer
4760.7
George Doe
george.doe@example.com
Inactive
Editor
2224.33
Hannah Doe
hannah.doe@example.com
Active
Manager
1641.24
Name
Email
Status
Role
Amount
John Doe
john.doe@example.com
Active
Admin
4447.82
Jane Doe
jane.doe@example.com
Pending
User
3524.81
Bob Doe
bob.doe@example.com
Inactive
Viewer
145.27
Alice Doe
alice.doe@example.com
Active
Editor
1869.82
Charlie Doe
charlie.doe@example.com
Pending
Manager
2110.61
Diana Doe
diana.doe@example.com
Inactive
Admin
478.18
Edward Doe
edward.doe@example.com
Active
User
1955.95
Fiona Doe
fiona.doe@example.com
Pending
Viewer
4760.7
George Doe
george.doe@example.com
Inactive
Editor
2224.33
Hannah Doe
hannah.doe@example.com
Active
Manager
1641.24
Disabled State
Name
Email
Status
Role
Amount
John Doe
john.doe@example.com
Active
Admin
4447.82
Jane Doe
jane.doe@example.com
Pending
User
3524.81
Bob Doe
bob.doe@example.com
Inactive
Viewer
145.27
Alice Doe
alice.doe@example.com
Active
Editor
1869.82
Charlie Doe
charlie.doe@example.com
Pending
Manager
2110.61
Diana Doe
diana.doe@example.com
Inactive
Admin
478.18
Edward Doe
edward.doe@example.com
Active
User
1955.95
Fiona Doe
fiona.doe@example.com
Pending
Viewer
4760.7
George Doe
george.doe@example.com
Inactive
Editor
2224.33
Hannah Doe
hannah.doe@example.com
Active
Manager
1641.24
Name
Email
Status
Role
Amount
John Doe
john.doe@example.com
Active
Admin
4447.82
Jane Doe
jane.doe@example.com
Pending
User
3524.81
Bob Doe
bob.doe@example.com
Inactive
Viewer
145.27
Alice Doe
alice.doe@example.com
Active
Editor
1869.82
Charlie Doe
charlie.doe@example.com
Pending
Manager
2110.61
Diana Doe
diana.doe@example.com
Inactive
Admin
478.18
Edward Doe
edward.doe@example.com
Active
User
1955.95
Fiona Doe
fiona.doe@example.com
Pending
Viewer
4760.7
George Doe
george.doe@example.com
Inactive
Editor
2224.33
Hannah Doe
hannah.doe@example.com
Active
Manager
1641.24
Name
Email
Status
Role
Amount
John Doe
john.doe@example.com
Active
Admin
4447.82
Jane Doe
jane.doe@example.com
Pending
User
3524.81
Bob Doe
bob.doe@example.com
Inactive
Viewer
145.27
Alice Doe
alice.doe@example.com
Active
Editor
1869.82
Charlie Doe
charlie.doe@example.com
Pending
Manager
2110.61
Diana Doe
diana.doe@example.com
Inactive
Admin
478.18
Edward Doe
edward.doe@example.com
Active
User
1955.95
Fiona Doe
fiona.doe@example.com
Pending
Viewer
4760.7
George Doe
george.doe@example.com
Inactive
Editor
2224.33
Hannah Doe
hannah.doe@example.com
Active
Manager
1641.24