Table Options (Props)
Many of the options you can pass to
useMaterialReactTable
are the same as the ones you can pass to the TanStack Table useReactTable hook.
Here is a list of all the table options that you can pass to the useMaterialReactTable
hook.
const table = useMaterialReactTable({// all the options that you can pass here (recommended)});//or all of the props that could be passed to `<MaterialReactTable />` IF not using `useMaterialReactTable` hookreturn (<MaterialReactTable// all of the props that could be passed here if no `table` prop is passed/>);return <MaterialReactTable table={table} />; //recommended
# | Prop Name | Type | Default Value | More Info Links | |
---|---|---|---|---|---|
1 |
| TanStack Table Custom Features Docs | |||
2 |
| TanStack Table Grouping Docs | |||
3 |
| TanStack Table Core Table Docs | |||
4 |
| TanStack Table Expanding Docs | |||
5 |
| TanStack Table Pagination Docs | |||
6 |
| MRT Column Filtering Docs | |||
7 |
|
| MRT Column Resizing Docs | ||
8 |
|
| MRT Column Resizing Docs | ||
9 |
| MRT Column Options API Reference | |||
10 |
| ||||
11 |
| ||||
12 |
| Usage Docs | |||
13 |
|
| TanStack Table Core Table Docs | ||
14 |
|
| TanStack Table Core Table Docs | ||
15 |
|
| TanStack Table Core Table Docs | ||
16 |
|
| TanStack Table Core Table Docs | ||
17 |
|
| TanStack Table Core Table Docs | ||
18 |
| TanStack Table Core Table Docs | |||
19 |
| MRT Display Columns Docs | |||
20 |
| MRT Display Columns Docs | |||
21 |
|
| MRT Editing Docs | ||
22 |
|
| MRT Row Selection Docs | ||
23 |
|
| MRT Customize Toolbars Docs | ||
24 |
| ||||
25 |
|
| MRT Click to Copy Docs | ||
26 |
|
| MRT Column Actions Docs | ||
27 |
|
| MRT Column Ordering DnD Docs | ||
28 |
|
| MRT Column Filtering Docs | ||
29 |
|
| MRT Column Filtering Docs | ||
30 |
| MRT Column Ordering DnD Docs | |||
31 |
| ||||
32 |
| MRT Column Resizing Docs | |||
33 |
| MRT Virtualization Docs | |||
34 |
|
| MRT Density Toggle Docs | ||
35 |
| MRT Editing Docs | |||
36 |
|
| MRT Expanding Sub Rows Docs | ||
37 |
| MRT Expanding Sub Rows Docs | |||
38 |
|
| TanStack Filters Docs | ||
39 |
|
| MRT Column Filtering Docs | ||
40 |
|
| TanStack Filters Docs | ||
41 |
|
| MRT Full Screen Toggle Docs | ||
42 |
|
| MRT Global Filtering Docs | ||
43 |
|
| MRT Global Filtering Docs | ||
44 |
|
| MRT Global Filtering Docs | ||
45 |
| MRT Aggregation and Grouping Docs | |||
46 |
|
| MRT Column Hiding Docs | ||
47 |
| TanStack Sorting Docs | |||
48 |
|
| MRT Row Selection Docs | ||
49 |
| ||||
50 |
|
| |||
51 |
| ||||
52 |
| ||||
53 |
| Row Numbers Feature Guide | |||
54 |
| ||||
55 |
| ||||
56 |
| MRT Row Selection Docs | |||
57 |
| MRT Virtualization Docs | |||
58 |
|
| |||
59 |
|
| |||
60 |
|
| |||
61 |
| ||||
62 |
| ||||
63 |
|
| |||
64 |
|
| |||
65 |
|
| |||
66 |
|
| |||
67 |
|
| |||
68 |
| ||||
69 |
| TanStack Table Filters Docs | |||
70 |
|
| TanStack Filtering Docs | ||
71 |
| ||||
72 |
| TanStack Table Core Table Docs | |||
73 |
| ||||
74 |
| TanStack Table Filters Docs | |||
75 |
| TanStack Table Filters Docs | |||
76 |
| TanStack Table Filters Docs | |||
77 |
| TanStack Table Filters Docs | |||
78 |
| TanStack Table Grouping Docs | |||
79 |
| TanStack Table Expanding Docs | |||
80 |
| ||||
81 |
| TanStack Table Expanding Docs | |||
82 |
| TanStack Table Core Table Docs | |||
83 |
| TanStack Table Sorting Docs | |||
84 |
| TanStack Table Core Table Docs | |||
85 |
| ||||
86 |
| ||||
87 |
|
| TanStack Table Grouping Docs | ||
88 |
| ||||
89 |
| Table State Management Guide | |||
90 |
| TanStack Table Sorting Docs | |||
91 |
|
| |||
92 |
|
| TODO | ||
93 |
| Localization (i18n) Guide | |||
94 |
| TanStack Table Expanding Docs | |||
95 |
| TanStack Table Filters Docs | |||
96 |
| TanStack Table Grouping Docs | |||
97 |
| TanStack Table Pagination Docs | |||
98 |
| TanStack Table Sorting Docs | |||
99 |
|
| TanStack Table Filtering Docs | ||
100 |
| TanStack Table Sorting Docs | |||
101 |
| Memoize Components Guide | |||
102 |
| TanStack Table Core Docs | |||
103 |
| TanStack Table Core Docs | |||
104 |
| Material UI Box Props | |||
105 |
| Material UI CircularProgress Props | |||
106 |
| Material UI IconButton Props | |||
107 |
| Material UI IconButton Props | |||
108 |
| Material UI Button Props | |||
109 |
| Material UI TableCell Props | |||
110 |
| Material UI Dialog Props | |||
111 |
| Material UI TextField Props | |||
112 |
| Material UI IconButton Props | |||
113 |
| Material UI IconButton Props | |||
114 |
| Material UI Autocomplete Props | |||
115 |
| Material UI Checkbox Props | |||
116 |
| MUI X DatePicker Props | |||
117 |
| MUI X DateTimePicker Props | |||
118 |
| Material UI Slider Props | |||
119 |
| Material UI TextField Props | |||
120 |
| MUI X TimePicker Props | |||
121 |
| Material UI LinearProgress Props | |||
122 |
| Material UI TablePagination Props | |||
123 |
| Material UI IconButton Props | |||
124 |
| Material UI TextField Props | |||
125 |
| Material UI Checkbox Props | |||
126 |
| Material UI Checkbox Props | |||
127 |
| Material UI Skeleton Props | |||
128 |
| Material UI TableCell Props | |||
129 |
| Material UI TableBody Props | |||
130 |
|
| Material UI TableRow Props | ||
131 |
| Material UI TableContainer Props | |||
132 |
| Material UI TableCell Props | |||
133 |
| Material UI TableFooter Props | |||
134 |
| Material UI TableRow Props | |||
135 |
| Material UI TableCell Props | |||
136 |
| Material UI TableHead Props | |||
137 |
| Material UI TableRow Props | |||
138 |
| Material UI Paper API Docs | |||
139 |
| Material UI TableProps API Docs | |||
140 |
| Material UI Chip Props | |||
141 |
| Material UI Alert Props | |||
142 |
| Material UI Box Props | |||
143 |
| ||||
144 |
| TanStack Table Filter Docs | |||
145 |
| TanStack Table Column Ordering Docs | |||
146 |
| TanStack Table Column Pinning Docs | |||
147 |
| TanStack Table Column Sizing Docs | |||
148 |
| TanStack Table Column Sizing Docs | |||
149 |
| TanStack Table Column Visibility Docs | |||
150 |
| MRT Editing Docs | |||
151 |
| ||||
152 |
| MRT Editing Docs | |||
153 |
| MRT Density Toggle Docs | |||
154 |
| ||||
155 |
| ||||
156 |
| ||||
157 |
| MRT Editing Docs | |||
158 |
| ||||
159 |
| MRT Editing Docs | |||
160 |
| TanStack Table Expanding Docs | |||
161 |
| TanStack Table Filters Docs | |||
162 |
| TanStack Table Filters Docs | |||
163 |
| TanStack Table Grouping Docs | |||
164 |
| ||||
165 |
| ||||
166 |
| MRT Full Screen Toggle Docs | |||
167 |
| TanStack Table Pagination Docs | |||
168 |
| TanStack Table Pinning Docs | |||
169 |
| TanStack Table Row Selection Docs | |||
170 |
| ||||
171 |
| ||||
172 |
| ||||
173 |
| ||||
174 |
| TanStack Table Sorting Docs | |||
175 |
| TanStack Table Pagination Docs | |||
176 |
| TanStack Table Expanding Docs | |||
177 |
| ||||
178 |
|
| |||
179 |
|
| |||
180 |
|
| |||
181 |
|
| |||
182 |
|
| |||
183 |
|
| |||
184 |
| ||||
185 |
| ||||
186 |
| ||||
187 |
| ||||
188 |
| ||||
189 |
| ||||
190 |
| ||||
191 |
| ||||
192 |
| ||||
193 |
| ||||
194 |
| ||||
195 |
| ||||
196 |
| ||||
197 |
| ||||
198 |
| ||||
199 |
| ||||
200 |
| ||||
201 |
| ||||
202 |
|
| |||
203 |
|
| |||
204 |
| ||||
205 |
| ||||
206 |
|
| |||
207 |
| TanStack Table Sorting Docs | |||
208 |
| TanStack Table Sorting Docs | |||
209 |
| Table State Management Guide | |||
Wanna see the source code for this table? Check it out down below!
1import { useEffect, useMemo, useState } from 'react';2import Link from 'next/link';3import {4 MaterialReactTable,5 type MRT_TableOptions,6 type MRT_ColumnDef,7} from 'material-react-table';8import {9 Link as MuiLink,10 Typography,11 useMediaQuery,12 useTheme,13} from '@mui/material';14import { SampleCodeSnippet } from '../mdx/SampleCodeSnippet';15import { type TableOption, tableOptions } from './tableOptions';1617interface Props {18 onlyOptions?: Set<keyof MRT_TableOptions<TableOption>>;19}2021const TableOptionsTable = ({ onlyOptions }: Props) => {22 const theme = useTheme();23 const isDesktop = useMediaQuery('(min-width: 1200px)');2425 const columns = useMemo<MRT_ColumnDef<TableOption>[]>(26 () => [27 {28 enableClickToCopy: true,29 header: 'Prop Name',30 accessorKey: 'tableOption',31 muiCopyButtonProps: ({ cell }) => ({32 className: 'prop',33 id: `${cell.getValue<string>()}-prop`,34 }),35 Cell: ({ renderedCellValue, row }) =>36 row.original?.required ? (37 <strong style={{ color: theme.palette.primary.dark }}>38 {renderedCellValue}*39 </strong>40 ) : (41 renderedCellValue42 ),43 },44 {45 header: 'Type',46 accessorKey: 'type',47 enableGlobalFilter: false,48 Cell: ({ cell }) => (49 <SampleCodeSnippet50 className="language-ts"51 enableCopyButton={false}52 style={{53 backgroundColor: 'transparent',54 fontSize: '0.9rem',55 margin: 0,56 padding: 0,57 minHeight: 'unset',58 }}59 >60 {cell.getValue<string>()}61 </SampleCodeSnippet>62 ),63 },64 {65 header: 'Default Value',66 accessorKey: 'defaultValue',67 enableGlobalFilter: false,68 Cell: ({ cell }) => (69 <SampleCodeSnippet70 className="language-js"71 enableCopyButton={false}72 style={{73 backgroundColor: 'transparent',74 fontSize: '0.9rem',75 margin: 0,76 padding: 0,77 minHeight: 'unset',78 }}79 >80 {cell.getValue<string>()}81 </SampleCodeSnippet>82 ),83 },84 {85 header: 'Description',86 accessorKey: 'description',87 enableGlobalFilter: false,88 },89 {90 header: 'More Info Links',91 accessorKey: 'link',92 disableFilters: true,93 enableGlobalFilter: false,94 Cell: ({ cell, row }) => (95 <Link href={cell.getValue<string>()} passHref legacyBehavior>96 <MuiLink97 color={98 row.original.source === 'MRT'99 ? 'text.primary'100 : row.original.source === 'Material UI'101 ? 'primary.main'102 : row.original.source === 'TanStack Table'103 ? 'secondary.main'104 : undefined105 }106 target={107 cell.getValue<string>().startsWith('http')108 ? '_blank'109 : undefined110 }111 rel="noopener"112 >113 {row.original?.linkText}114 </MuiLink>115 </Link>116 ),117 },118 ],119 [theme],120 );121122 const [columnPinning, setColumnPinning] = useState({});123124 useEffect(() => {125 if (typeof window !== 'undefined') {126 if (isDesktop) {127 setColumnPinning({128 left: ['mrt-row-expand', 'mrt-row-numbers', 'tableOption'],129 right: ['link'],130 });131 } else {132 setColumnPinning({});133 }134 }135 }, [isDesktop]);136137 const data = useMemo(() => {138 if (onlyOptions) {139 return tableOptions.filter(({ tableOption }) =>140 onlyOptions.has(tableOption),141 );142 }143 return tableOptions;144 }, [onlyOptions]);145146 return (147 <MaterialReactTable148 columns={columns}149 data={data}150 displayColumnDefOptions={{151 'mrt-row-numbers': {152 size: 10,153 },154 'mrt-row-expand': {155 size: 10,156 },157 }}158 enableColumnActions={!onlyOptions}159 enableColumnFilterModes160 enablePagination={false}161 enableColumnPinning162 enableRowNumbers163 enableBottomToolbar={false}164 enableTopToolbar={!onlyOptions}165 initialState={{166 columnVisibility: { description: false },167 density: 'compact',168 showGlobalFilter: true,169 sorting: [{ id: 'tableOption', desc: false }],170 }}171 muiSearchTextFieldProps={{172 placeholder: 'Search All Props',173 sx: { minWidth: '18rem' },174 variant: 'outlined',175 }}176 muiTablePaperProps={{177 sx: { mb: '1.5rem' },178 id: onlyOptions ? 'relevant-props-table' : 'props-table',179 }}180 positionGlobalFilter="left"181 renderDetailPanel={({ row }) => (182 <Typography183 color={row.original.description ? 'secondary.main' : 'text.secondary'}184 >185 {row.original.description || 'No Description Provided... Yet...'}186 </Typography>187 )}188 rowNumberDisplayMode="static"189 onColumnPinningChange={setColumnPinning}190 state={{ columnPinning }}191 />192 );193};194195export default TableOptionsTable;196