Table Options (Props)
Many of the options you can pass to
useMaterialReactTableare 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 |
|
| |||
| 48 |
| TanStack Sorting Docs | |||
| 49 |
|
| MRT Row Selection Docs | ||
| 50 |
| ||||
| 51 |
|
| |||
| 52 |
| ||||
| 53 |
| ||||
| 54 |
| Row Numbers Feature Guide | |||
| 55 |
| ||||
| 56 |
| ||||
| 57 |
| MRT Row Selection Docs | |||
| 58 |
| MRT Virtualization Docs | |||
| 59 |
|
| |||
| 60 |
|
| |||
| 61 |
|
| |||
| 62 |
| ||||
| 63 |
| ||||
| 64 |
|
| |||
| 65 |
|
| |||
| 66 |
|
| |||
| 67 |
|
| |||
| 68 |
|
| |||
| 69 |
| ||||
| 70 |
| TanStack Table Filters Docs | |||
| 71 |
|
| TanStack Filtering Docs | ||
| 72 |
| ||||
| 73 |
| TanStack Table Core Table Docs | |||
| 74 |
| ||||
| 75 |
| TanStack Table Filters Docs | |||
| 76 |
| TanStack Table Filters Docs | |||
| 77 |
| TanStack Table Filters Docs | |||
| 78 |
| TanStack Table Filters Docs | |||
| 79 |
| TanStack Table Grouping Docs | |||
| 80 |
| TanStack Table Expanding Docs | |||
| 81 |
| ||||
| 82 |
| TanStack Table Expanding Docs | |||
| 83 |
| TanStack Table Core Table Docs | |||
| 84 |
| TanStack Table Sorting Docs | |||
| 85 |
| TanStack Table Core Table Docs | |||
| 86 |
| ||||
| 87 |
| ||||
| 88 |
|
| TanStack Table Grouping Docs | ||
| 89 |
| ||||
| 90 |
| Table State Management Guide | |||
| 91 |
| TanStack Table Sorting Docs | |||
| 92 |
|
| |||
| 93 |
|
| TODO | ||
| 94 |
| Localization (i18n) Guide | |||
| 95 |
| TanStack Table Expanding Docs | |||
| 96 |
| TanStack Table Filters Docs | |||
| 97 |
| TanStack Table Grouping Docs | |||
| 98 |
| TanStack Table Pagination Docs | |||
| 99 |
| TanStack Table Sorting Docs | |||
| 100 |
|
| TanStack Table Filtering Docs | ||
| 101 |
| TanStack Table Sorting Docs | |||
| 102 |
| Memoize Components Guide | |||
| 103 |
| TanStack Table Core Docs | |||
| 104 |
| TanStack Table Core Docs | |||
| 105 |
| Material UI Box Props | |||
| 106 |
| Material UI CircularProgress Props | |||
| 107 |
| Material UI IconButton Props | |||
| 108 |
| Material UI IconButton Props | |||
| 109 |
| Material UI Button Props | |||
| 110 |
| Material UI TableCell Props | |||
| 111 |
| Material UI Dialog Props | |||
| 112 |
| Material UI TextField Props | |||
| 113 |
| Material UI IconButton Props | |||
| 114 |
| Material UI IconButton Props | |||
| 115 |
| Material UI Autocomplete Props | |||
| 116 |
| Material UI Checkbox Props | |||
| 117 |
| MUI X DatePicker Props | |||
| 118 |
| MUI X DateTimePicker Props | |||
| 119 |
| Material UI Slider Props | |||
| 120 |
| Material UI TextField Props | |||
| 121 |
| MUI X TimePicker Props | |||
| 122 |
| Material UI LinearProgress Props | |||
| 123 |
| Material UI TablePagination Props | |||
| 124 |
| Material UI IconButton Props | |||
| 125 |
| Material UI TextField Props | |||
| 126 |
| Material UI Checkbox Props | |||
| 127 |
| Material UI Checkbox Props | |||
| 128 |
| Material UI Skeleton Props | |||
| 129 |
| Material UI TableCell Props | |||
| 130 |
| Material UI TableBody Props | |||
| 131 |
|
| Material UI TableRow Props | ||
| 132 |
| Material UI TableContainer Props | |||
| 133 |
| Material UI TableCell Props | |||
| 134 |
| Material UI TableFooter Props | |||
| 135 |
| Material UI TableRow Props | |||
| 136 |
| Material UI TableCell Props | |||
| 137 |
| Material UI TableHead Props | |||
| 138 |
| Material UI TableRow Props | |||
| 139 |
| Material UI Paper API Docs | |||
| 140 |
| Material UI TableProps API Docs | |||
| 141 |
| Material UI Chip Props | |||
| 142 |
| Material UI Alert Props | |||
| 143 |
| Material UI Box Props | |||
| 144 |
| ||||
| 145 |
| TanStack Table Filter Docs | |||
| 146 |
| TanStack Table Column Ordering Docs | |||
| 147 |
| TanStack Table Column Pinning Docs | |||
| 148 |
| TanStack Table Column Sizing Docs | |||
| 149 |
| TanStack Table Column Sizing Docs | |||
| 150 |
| TanStack Table Column Visibility Docs | |||
| 151 |
| MRT Editing Docs | |||
| 152 |
| ||||
| 153 |
| MRT Editing Docs | |||
| 154 |
| MRT Density Toggle Docs | |||
| 155 |
| ||||
| 156 |
| ||||
| 157 |
| ||||
| 158 |
| MRT Editing Docs | |||
| 159 |
| ||||
| 160 |
| MRT Editing Docs | |||
| 161 |
| TanStack Table Expanding Docs | |||
| 162 |
| TanStack Table Filters Docs | |||
| 163 |
| TanStack Table Filters Docs | |||
| 164 |
| TanStack Table Grouping Docs | |||
| 165 |
| ||||
| 166 |
| ||||
| 167 |
| MRT Full Screen Toggle Docs | |||
| 168 |
| TanStack Table Pagination Docs | |||
| 169 |
| TanStack Table Pinning Docs | |||
| 170 |
| TanStack Table Row Selection Docs | |||
| 171 |
| ||||
| 172 |
| ||||
| 173 |
| ||||
| 174 |
| ||||
| 175 |
| TanStack Table Sorting Docs | |||
| 176 |
| TanStack Table Pagination Docs | |||
| 177 |
| TanStack Table Expanding Docs | |||
| 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 |
|
| |||
| 208 |
| TanStack Table Sorting Docs | |||
| 209 |
| TanStack Table Sorting Docs | |||
| 210 |
| 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