Data Grid
DataMITData grid with row selection and inline cell editing.
bun add @otfdashkit/ui
Preview
Data GridData
Loading Storybook preview…
Code
@otfdashkit/uiimport { DataGrid } from '@otfdashkit/ui'
interface User {
id: string
name: string
email: string
role: 'Admin' | 'Member' | 'Viewer'
status: 'Active' | 'Inactive' | 'Pending'
createdAt: string
}
function makeUsers(n: number): User[] {
const roles: User['role'][] = ['Admin', 'Member', 'Viewer']
const statuses: User['status'][] = ['Active', 'Inactive', 'Pending']
return Array.from({ length: n }, (_, i) => ({
id: String(i + 1),
name: `User ${i + 1}`,
email: `user${i + 1}@example.com`,
role: roles[i % 3]!,
status: statuses[i % 3]!,
createdAt: new Date(Date.now() - i * 86400000).toLocaleDateString(),
}))
}
export function Example() {
return <DataGrid<User> data={makeUsers(20)} />
}
Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.
Props
Props declared in the DataGrid source. Inherited HTML attributes are not listed.
| Prop | Type | Default | Description |
|---|---|---|---|
| columnsrequired | ColumnDef<T, any>[] | ||
| datarequired | T[] | ||
| className | string | ||
| editable | boolean | ||
| onDataChange | (data: T[]) => void |