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 Grouping Docs | |||
2 |
| TanStack Table Core Table Docs | |||
3 |
| TanStack Table Expanding Docs | |||
4 |
| TanStack Table Pagination Docs | |||
5 |
| MRT Column Filtering Docs | |||
6 |
|
| MRT Column Resizing Docs | ||
7 |
|
| MRT Column Resizing Docs | ||
8 |
| MRT Column Options API Reference | |||
9 |
| ||||
10 |
| ||||
11 |
| Usage Docs | |||
12 |
|
| TanStack Table Core Table 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 |
| MRT Display Columns Docs | |||
19 |
| MRT Display Columns Docs | |||
20 |
|
| MRT Editing Docs | ||
21 |
|
| MRT Row Selection Docs | ||
22 |
|
| MRT Customize Toolbars Docs | ||
23 |
| ||||
24 |
|
| MRT Click to Copy Docs | ||
25 |
|
| MRT Column Actions Docs | ||
26 |
|
| MRT Column Ordering DnD Docs | ||
27 |
|
| MRT Column Filtering Docs | ||
28 |
|
| MRT Column Filtering Docs | ||
29 |
| MRT Column Ordering DnD Docs | |||
30 |
| ||||
31 |
| MRT Column Resizing Docs | |||
32 |
| MRT Virtualization Docs | |||
33 |
|
| MRT Density Toggle Docs | ||
34 |
| MRT Editing Docs | |||
35 |
|
| MRT Expanding Sub Rows Docs | ||
36 |
| MRT Expanding Sub Rows Docs | |||
37 |
|
| TanStack Filters Docs | ||
38 |
|
| MRT Column Filtering Docs | ||
39 |
|
| TanStack Filters Docs | ||
40 |
|
| MRT Full Screen Toggle Docs | ||
41 |
|
| MRT Global Filtering Docs | ||
42 |
|
| MRT Global Filtering Docs | ||
43 |
|
| MRT Global Filtering Docs | ||
44 |
| MRT Aggregation and Grouping Docs | |||
45 |
|
| MRT Column Hiding Docs | ||
46 |
| TanStack Sorting Docs | |||
47 |
|
| MRT Row Selection Docs | ||
48 |
| ||||
49 |
|
| |||
50 |
| ||||
51 |
| ||||
52 |
| Row Numbers Feature Guide | |||
53 |
| ||||
54 |
| ||||
55 |
| MRT Row Selection Docs | |||
56 |
| MRT Virtualization Docs | |||
57 |
|
| |||
58 |
|
| |||
59 |
|
| |||
60 |
| ||||
61 |
| ||||
62 |
|
| |||
63 |
|
| |||
64 |
|
| |||
65 |
|
| |||
66 |
|
| |||
67 |
| ||||
68 |
| TanStack Table Filters Docs | |||
69 |
|
| TanStack Filtering Docs | ||
70 |
| ||||
71 |
| TanStack Table Core Table Docs | |||
72 |
| ||||
73 |
| TanStack Table Filters Docs | |||
74 |
| TanStack Table Filters Docs | |||
75 |
| TanStack Table Filters Docs | |||
76 |
| TanStack Table Filters Docs | |||
77 |
| TanStack Table Grouping Docs | |||
78 |
| TanStack Table Expanding Docs | |||
79 |
| ||||
80 |
| TanStack Table Expanding Docs | |||
81 |
| TanStack Table Core Table Docs | |||
82 |
| TanStack Table Sorting Docs | |||
83 |
| TanStack Table Core Table Docs | |||
84 |
| ||||
85 |
| ||||
86 |
|
| TanStack Table Grouping Docs | ||
87 |
| ||||
88 |
| Table State Management Guide | |||
89 |
| TanStack Table Sorting Docs | |||
90 |
|
| |||
91 |
|
| TODO | ||
92 |
| Localization (i18n) Guide | |||
93 |
| TanStack Table Expanding Docs | |||
94 |
| TanStack Table Filters Docs | |||
95 |
| TanStack Table Grouping Docs | |||
96 |
| TanStack Table Pagination Docs | |||
97 |
| TanStack Table Sorting Docs | |||
98 |
|
| TanStack Table Filtering Docs | ||
99 |
| TanStack Table Sorting Docs | |||
100 |
| Memoize Components Guide | |||
101 |
| TanStack Table Core Docs | |||
102 |
| TanStack Table Core Docs | |||
103 |
| Material UI Box Props | |||
104 |
| Material UI CircularProgress Props | |||
105 |
| Material UI IconButton Props | |||
106 |
| Material UI IconButton Props | |||
107 |
| Material UI Button Props | |||
108 |
| Material UI TableCell Props | |||
109 |
| Material UI Dialog Props | |||
110 |
| Material UI TextField Props | |||
111 |
| Material UI IconButton Props | |||
112 |
| Material UI IconButton Props | |||
113 |
| Material UI Autocomplete Props | |||
114 |
| Material UI Checkbox Props | |||
115 |
| MUI X DatePicker Props | |||
116 |
| MUI X DateTimePicker Props | |||
117 |
| Material UI Slider Props | |||
118 |
| Material UI TextField Props | |||
119 |
| MUI X TimePicker Props | |||
120 |
| Material UI LinearProgress Props | |||
121 |
| Material UI TablePagination Props | |||
122 |
| Material UI IconButton Props | |||
123 |
| Material UI TextField Props | |||
124 |
| Material UI Checkbox Props | |||
125 |
| Material UI Checkbox Props | |||
126 |
| Material UI Skeleton Props | |||
127 |
| Material UI TableCell Props | |||
128 |
| Material UI TableBody Props | |||
129 |
|
| Material UI TableRow Props | ||
130 |
| Material UI TableContainer Props | |||
131 |
| Material UI TableCell Props | |||
132 |
| Material UI TableFooter Props | |||
133 |
| Material UI TableRow Props | |||
134 |
| Material UI TableCell Props | |||
135 |
| Material UI TableHead Props | |||
136 |
| Material UI TableRow Props | |||
137 |
| Material UI Paper API Docs | |||
138 |
| Material UI TableProps API Docs | |||
139 |
| Material UI Chip Props | |||
140 |
| Material UI Alert Props | |||
141 |
| Material UI Box Props | |||
142 |
| ||||
143 |
| TanStack Table Filter Docs | |||
144 |
| TanStack Table Column Ordering Docs | |||
145 |
| TanStack Table Column Pinning Docs | |||
146 |
| TanStack Table Column Sizing Docs | |||
147 |
| TanStack Table Column Sizing Docs | |||
148 |
| TanStack Table Column Visibility Docs | |||
149 |
| MRT Editing Docs | |||
150 |
| ||||
151 |
| MRT Editing Docs | |||
152 |
| MRT Density Toggle Docs | |||
153 |
| ||||
154 |
| ||||
155 |
| ||||
156 |
| MRT Editing Docs | |||
157 |
| ||||
158 |
| MRT Editing Docs | |||
159 |
| TanStack Table Expanding Docs | |||
160 |
| TanStack Table Filters Docs | |||
161 |
| TanStack Table Filters Docs | |||
162 |
| TanStack Table Grouping Docs | |||
163 |
| ||||
164 |
| ||||
165 |
| MRT Full Screen Toggle Docs | |||
166 |
| TanStack Table Pagination Docs | |||
167 |
| TanStack Table Pinning Docs | |||
168 |
| TanStack Table Row Selection Docs | |||
169 |
| ||||
170 |
| ||||
171 |
| ||||
172 |
| ||||
173 |
| TanStack Table Sorting Docs | |||
174 |
| TanStack Table Pagination Docs | |||
175 |
| TanStack Table Expanding Docs | |||
176 |
| ||||
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 |
| TanStack Table Sorting Docs | |||
206 |
| TanStack Table Sorting Docs | |||
207 |
| 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