Skip to content

Commit 4fc73a6

Browse files
committed
add compatibility chart
1 parent f66c6ff commit 4fc73a6

File tree

3 files changed

+143
-5
lines changed

3 files changed

+143
-5
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import React from 'react';
2+
import {
3+
MRT_ColumnDef,
4+
MRT_TableContainer,
5+
useMaterialReactTable,
6+
} from 'material-react-table';
7+
8+
const columns: MRT_ColumnDef<any>[] = [
9+
{
10+
accessorKey: 'mrtVersion',
11+
header: 'MRT',
12+
},
13+
{
14+
accessorKey: 'reactVersion',
15+
header: 'React',
16+
size: 100,
17+
},
18+
{
19+
accessorKey: 'muiVersion',
20+
header: 'Material UI',
21+
size: 100,
22+
},
23+
{
24+
accessorKey: 'muiIconsVersion',
25+
header: ' MUI Icons',
26+
size: 100,
27+
},
28+
{
29+
accessorKey: 'muiXDatePickers',
30+
header: 'MUI X Date Pickers',
31+
},
32+
{
33+
accessorKey: 'emotionVersion',
34+
header: 'Emotion',
35+
size: 100,
36+
},
37+
{
38+
accessorKey: 'pigmentCSS',
39+
header: 'Pigment CSS',
40+
},
41+
];
42+
43+
const data = [
44+
{
45+
mrtVersion: '1.x',
46+
muiVersion: '5.0+',
47+
muiXDatePickers: 'Optional',
48+
reactVersion: '17.0+',
49+
muiIconsVersion: '5.0+',
50+
emotionVersion: '11.0+',
51+
pigmentCSS: '-',
52+
},
53+
{
54+
mrtVersion: '2.x',
55+
muiVersion: '5.13+',
56+
muiXDatePickers: '6.15+',
57+
reactVersion: '17.0+',
58+
muiIconsVersion: '5.0+',
59+
emotionVersion: '11.0+',
60+
pigmentCSS: '-',
61+
},
62+
{
63+
mrtVersion: '3.x (This Version)',
64+
muiVersion: '6.0+',
65+
muiXDatePickers: '7.15.0+',
66+
reactVersion: '18.0+',
67+
muiIconsVersion: '6.0+',
68+
emotionVersion: '11.0+',
69+
pigmentCSS: 'Optional',
70+
},
71+
{
72+
mrtVersion: '4.x (Next Version)',
73+
muiVersion: '6.0+',
74+
muiXDatePickers: '7.15.0+',
75+
reactVersion: '18.0+',
76+
muiIconsVersion: '6.0+',
77+
emotionVersion: 'Optional',
78+
pigmentCSS: 'Optional',
79+
},
80+
];
81+
82+
export const CompatibilityTable = () => {
83+
const table = useMaterialReactTable({
84+
columns,
85+
data,
86+
defaultColumn: {
87+
muiTableHeadCellProps: {
88+
sx: {
89+
fontSize: '16px',
90+
},
91+
},
92+
muiTableBodyCellProps: ({ row }) => ({
93+
sx: (theme) => ({
94+
fontSize: '16px',
95+
fontWeight: row.original.mrtVersion.includes('This Version')
96+
? 'bold'
97+
: 'normal',
98+
color: row.original.mrtVersion.includes('This Version')
99+
? `${theme.palette.primary.main}`
100+
: 'inherit',
101+
}),
102+
}),
103+
},
104+
enableColumnActions: false,
105+
initialState: {
106+
sorting: [
107+
{
108+
id: 'mrtVersion',
109+
desc: true,
110+
},
111+
],
112+
},
113+
});
114+
return <MRT_TableContainer table={table} />;
115+
};

apps/material-react-table-docs/components/mdx/SampleCodeSnippet.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export const SampleCodeSnippet = ({ paperSxProps, ...props }: Props) => {
6969
code={code}
7070
language={language}
7171
theme={
72-
theme.palette.mode === 'dark' ? themes.oneDark : themes.jettwaveLight
72+
theme.palette.mode === 'dark'
73+
? themes.oceanicNext
74+
: themes.nightOwlLight
7375
}
7476
>
7577
{({ className, style, tokens, getLineProps, getTokenProps }) => (

apps/material-react-table-docs/pages/docs/getting-started/install.mdx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import Head from 'next/head';
22
import { InstallCommand } from '../../../components/mdx/InstallCommand';
33
import { FAQs } from '../../../components/mdx/FAQs';
4+
import { CompatibilityTable } from '../../../components/mdx/CompatibilityTable';
45

56
<Head>
67
<title>{'Installation - Material React Table V3 Docs'}</title>
78
<meta name="description" content="How to install Material React Table" />
89
</Head>
910

11+
## Compatibility Chart
12+
13+
First, before installing Material React Table, let's make sure you have the correct versions of React, Material UI, and Material UI X Date Pickers installed.
14+
15+
<CompatibilityTable />
16+
1017
## Installation
1118

1219
> `material-react-table` requires **Material UI V6** packages as dependencies in your project.
@@ -36,6 +43,18 @@ import { FAQs } from '../../../components/mdx/FAQs';
3643
3744
### Common Errors
3845

46+
If you see a react import error like this:
47+
48+
```bash
49+
Uncaught TypeError: (0 , import_react15.useId) is not a function
50+
at useMRT_TableOptions (useMRT_TableOptions.ts:95:8)
51+
at useMaterialReactTable (useMaterialReactTable.ts:12:24)
52+
```
53+
54+
It means that you don't have the correct version of React installed. Make sure you have React 18.0 or higher.
55+
56+
---
57+
3958
If you get an error like this:
4059

4160
```bash
@@ -46,14 +65,16 @@ or a class/function (for composite components) but got: undefined.
4665
You likely forgot to export your component from the file it's defined in,
4766
or you might have mixed up default and named imports.
4867
49-
Or You might be trying to import `MaterialReactTable` from the default export still, which is no longer supported in v2. Make sure you are importing the named export instead:
68+
Or You might be trying to import `MaterialReactTable` from the default export still, which is no longer supported in v2+. Make sure you are importing the named export instead:
5069
5170
```diff
5271
- import MaterialReactTable from 'material-react-table'
5372
+ import { MaterialReactTable } from 'material-react-table'
5473
```
5574
56-
Or you probably do not have the correct version of Material UI installed. Make sure all material ui packages are at least V6.11 or higher.
75+
Or you probably do not have the correct version of Material UI installed. Make sure all material ui packages are at least V6.0 or higher if you are using MRT v3 or higher.
76+
77+
---
5778
5879
If you are using an older version of `webpack` or `create-react-app` and get an error like this:
5980
@@ -74,10 +95,10 @@ Then try upgrading either `webpack` or `react-scripts` to the latest versions.
7495
mainEntity: [
7596
{
7697
'@type': 'Question',
77-
name: 'Why is React 17 or 18 required for Material React Table?',
98+
name: 'Why is React 18 required for Material React Table?',
7899
acceptedAnswer: {
79100
'@type': 'Answer',
80-
text: '<p>React 17 or later is required by Material UI V6 itself. Some event listeners on Material UI TextField components will not work with React 16.x.</p>',
101+
text: '<p>As of MRT V3, it uses some React 18+ features, so React 18 is required. MRT V2 and below are compatible with React 17.</p>',
81102
},
82103
},
83104
{

0 commit comments

Comments
 (0)