1import { useMemo } from 'react';
2import {
3 MaterialReactTable,
4 useMaterialReactTable,
5 type MRT_ColumnDef,
6} from 'material-react-table';
7import { data, type Person } from './makeData';
8
9const Example = () => {
10 const columns = useMemo(
11
12 () =>
13 [
14 {
15 accessorKey: 'firstName',
16 header: 'First Name',
17 },
18 {
19 accessorKey: 'lastName',
20 header: 'Last Name',
21 },
22 {
23 accessorKey: 'address',
24 header: 'Address',
25 },
26 {
27 accessorKey: 'city',
28 header: 'City',
29 },
30 {
31 accessorKey: 'state',
32 header: 'State',
33 },
34 ] as MRT_ColumnDef<Person>[],
35 [],
36
37 );
38
39 const table = useMaterialReactTable({
40 columns,
41 data,
42 enableDensityToggle: false,
43 initialState: { density: 'compact' },
44 });
45
46 return <MaterialReactTable table={table} />;
47};
48
49export default Example;
50
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4