Appearance
Function: DataTable()
ts
function DataTable(props: BaseProps<unknown, unknown> & {
hidden?: AsyncProp<boolean>;
disabled?: AsyncProp<boolean>;
data?: | unknown[]
| (params: {
data: Record<string, unknown>;
value: unknown;
}) => unknown[] | Promise<unknown[]>;
}): Block;Defined in: src/renderer/blocks/index.ts:1608
Experimental
DataTable — sortable, filterable table with row selection, column visibility, and pagination. Built on @tanstack/react-table.
Parameters
| Parameter | Type |
|---|---|
props | BaseProps<unknown, unknown> & { hidden?: AsyncProp<boolean>; disabled?: AsyncProp<boolean>; data?: | unknown[] | (params: { data: Record<string, unknown>; value: unknown; }) => unknown[] | Promise<unknown[]>; } |
Returns
Example
ts
DataTable({
columns: [
{accessorKey: 'name', header: 'Name'},
{accessorKey: 'status', header: 'Status'},
{accessorKey: 'role', header: 'Role'},
],
data: [
{name: 'Ada Lovelace', status: 'active', role: 'Admin'},
{name: 'Alan Turing', status: 'invited', role: 'Member'},
],
searchKey: 'name',
});