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