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});//Note: you can also pass table options directly to the MaterialReactTable component instead of the useMaterialReactTable hook//But this will not be encouraged as it will be deprecated in the futurereturn <MaterialReactTable table={table} />;
# | 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 Options API Reference | |||
8 |
| ||||
9 |
| ||||
10 |
| Usage Docs | |||
11 |
|
| TanStack Table Core Table 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 |
| MRT Display Columns Docs | |||
18 |
| MRT Display Columns Docs | |||
19 |
|
| MRT Editing Docs | ||
20 |
|
| MRT Customize Toolbars Docs | ||
21 |
|
| MRT Click to Copy Docs | ||
22 |
|
| MRT Column Actions Docs | ||
23 |
|
| MRT Column Ordering DnD Docs | ||
24 |
|
| MRT Column Filtering Docs | ||
25 |
|
| MRT Column Filtering Docs | ||
26 |
| MRT Column Ordering DnD Docs | |||
27 |
| ||||
28 |
| MRT Column Resizing Docs | |||
29 |
| MRT Virtualization Docs | |||
30 |
|
| MRT Density Toggle Docs | ||
31 |
| MRT Editing Docs | |||
32 |
|
| MRT Expanding Sub Rows Docs | ||
33 |
| MRT Expanding Sub Rows Docs | |||
34 |
|
| TanStack Filters Docs | ||
35 |
|
| MRT Column Filtering Docs | ||
36 |
|
| TanStack Filters Docs | ||
37 |
|
| MRT Full Screen Toggle Docs | ||
38 |
|
| MRT Global Filtering Docs | ||
39 |
|
| MRT Global Filtering Docs | ||
40 |
|
| MRT Global Filtering Docs | ||
41 |
| MRT Aggregation and Grouping Docs | |||
42 |
|
| MRT Column Hiding Docs | ||
43 |
| TanStack Sorting Docs | |||
44 |
|
| MRT Row Selection Docs | ||
45 |
| ||||
46 |
|
| |||
47 |
| ||||
48 |
| ||||
49 |
| Row Numbers Feature Guide | |||
50 |
| ||||
51 |
| ||||
52 |
| ||||
53 |
| MRT Virtualization Docs | |||
54 |
|
| |||
55 |
|
| |||
56 |
|
| |||
57 |
| ||||
58 |
| ||||
59 |
|
| |||
60 |
|
| |||
61 |
|
| |||
62 |
|
| |||
63 |
|
| |||
64 |
| ||||
65 |
| TanStack Table Filters Docs | |||
66 |
|
| TanStack Filtering Docs | ||
67 |
| ||||
68 |
| TanStack Table Core Table Docs | |||
69 |
| ||||
70 |
| TanStack Table Filters Docs | |||
71 |
| TanStack Table Filters Docs | |||
72 |
| TanStack Table Filters Docs | |||
73 |
| TanStack Table Filters Docs | |||
74 |
| TanStack Table Grouping Docs | |||
75 |
| TanStack Table Expanding Docs | |||
76 |
| ||||
77 |
| TanStack Table Expanding Docs | |||
78 |
| TanStack Table Core Table Docs | |||
79 |
| TanStack Table Sorting Docs | |||
80 |
| TanStack Table Core Table Docs | |||
81 |
| ||||
82 |
| ||||
83 |
|
| TanStack Table Grouping Docs | ||
84 |
| ||||
85 |
| Table State Management Guide | |||
86 |
| TanStack Table Sorting Docs | |||
87 |
|
| |||
88 |
|
| TODO | ||
89 |
| Localization (i18n) Guide | |||
90 |
| TanStack Table Expanding Docs | |||
91 |
| TanStack Table Filters Docs | |||
92 |
| TanStack Table Grouping Docs | |||
93 |
| TanStack Table Pagination Docs | |||
94 |
| TanStack Table Sorting Docs | |||
95 |
|
| TanStack Table Filtering Docs | ||
96 |
| TanStack Table Sorting Docs | |||
97 |
| Memoize Components Guide | |||
98 |
| TanStack Table Core Docs | |||
99 |
| TanStack Table Core Docs | |||
100 |
| Material UI Box Props | |||
101 |
| Material UI CircularProgress Props | |||
102 |
| Material UI IconButton Props | |||
103 |
| Material UI IconButton Props | |||
104 |
| Material UI Button Props | |||
105 |
| Material UI TableCell Props | |||
106 |
| Material UI Dialog Props | |||
107 |
| Material UI TextField Props | |||
108 |
| Material UI IconButton Props | |||
109 |
| Material UI IconButton Props | |||
110 |
| Material UI Autocomplete Props | |||
111 |
| Material UI Checkbox Props | |||
112 |
| MUI X DatePicker Props | |||
113 |
| Material UI Slider Props | |||
114 |
| Material UI TextField Props | |||
115 |
| Material UI LinearProgress Props | |||
116 |
| Material UI TablePagination Props | |||
117 |
| Material UI IconButton Props | |||
118 |
| Material UI TextField Props | |||
119 |
| Material UI Checkbox Props | |||
120 |
| Material UI Checkbox Props | |||
121 |
| Material UI Skeleton Props | |||
122 |
| Material UI TableCell Props | |||
123 |
| Material UI TableBody Props | |||
124 |
|
| Material UI TableRow Props | ||
125 |
| Material UI TableContainer Props | |||
126 |
| Material UI TableCell Props | |||
127 |
| Material UI TableFooter Props | |||
128 |
| Material UI TableRow Props | |||
129 |
| Material UI TableCell Props | |||
130 |
| Material UI TableHead Props | |||
131 |
| Material UI TableRow Props | |||
132 |
| Material UI Paper API Docs | |||
133 |
| Material UI TableProps API Docs | |||
134 |
| Material UI Chip Props | |||
135 |
| Material UI Alert Props | |||
136 |
| Material UI Box Props | |||
137 |
| ||||
138 |
| TanStack Table Filter Docs | |||
139 |
| TanStack Table Column Ordering Docs | |||
140 |
| TanStack Table Column Pinning Docs | |||
141 |
| TanStack Table Column Sizing Docs | |||
142 |
| TanStack Table Column Sizing Docs | |||
143 |
| TanStack Table Column Visibility Docs | |||
144 |
| MRT Editing Docs | |||
145 |
| ||||
146 |
| MRT Editing Docs | |||
147 |
| MRT Density Toggle Docs | |||
148 |
| ||||
149 |
| ||||
150 |
| ||||
151 |
| MRT Editing Docs | |||
152 |
| ||||
153 |
| MRT Editing Docs | |||
154 |
| TanStack Table Expanding Docs | |||
155 |
| TanStack Table Filters Docs | |||
156 |
| TanStack Table Filters Docs | |||
157 |
| TanStack Table Grouping Docs | |||
158 |
| ||||
159 |
| ||||
160 |
| MRT Full Screen Toggle Docs | |||
161 |
| TanStack Table Pagination Docs | |||
162 |
| TanStack Table Pinning Docs | |||
163 |
| TanStack Table Row Selection Docs | |||
164 |
| ||||
165 |
| ||||
166 |
| ||||
167 |
| ||||
168 |
| TanStack Table Sorting Docs | |||
169 |
| TanStack Table Pagination Docs | |||
170 |
| TanStack Table Expanding Docs | |||
171 |
| ||||
172 |
| ||||
173 |
| ||||
174 |
| ||||
175 |
| ||||
176 |
| ||||
177 |
| ||||
178 |
| ||||
179 |
| ||||
180 |
| ||||
181 |
| ||||
182 |
| ||||
183 |
| ||||
184 |
| ||||
185 |
| ||||
186 |
| ||||
187 |
| ||||
188 |
| ||||
189 |
| ||||
190 |
| ||||
191 |
| ||||
192 |
|
| |||
193 |
|
| |||
194 |
| ||||
195 |
| ||||
196 |
|
| |||
197 |
| TanStack Table Sorting Docs | |||
198 |
| TanStack Table Sorting Docs | |||
199 |
| 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