@mini_7/material-react-table-mcp 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/README.md +68 -0
  2. package/data/MIGRATION.md +136 -0
  3. package/data/api.json +5379 -0
  4. package/data/examples/advanced.tsx +309 -0
  5. package/data/examples/aggregation-and-grouping.tsx +153 -0
  6. package/data/examples/aggregation-multi.tsx +105 -0
  7. package/data/examples/alternate-column-filtering.tsx +49 -0
  8. package/data/examples/alternate-detail-panel.tsx +81 -0
  9. package/data/examples/alternate-pagination.tsx +23 -0
  10. package/data/examples/basic.tsx +109 -0
  11. package/data/examples/chart-detail-panel.tsx +89 -0
  12. package/data/examples/column-actions-space.tsx +44 -0
  13. package/data/examples/column-alignment.tsx +70 -0
  14. package/data/examples/custom-column-actions.tsx +109 -0
  15. package/data/examples/custom-column-filtering-ui.tsx +89 -0
  16. package/data/examples/custom-headless.tsx +125 -0
  17. package/data/examples/custom-top-toolbar.tsx +88 -0
  18. package/data/examples/customize-display-columns.tsx +85 -0
  19. package/data/examples/customize-filter-components.tsx +101 -0
  20. package/data/examples/customize-filter-modes.tsx +73 -0
  21. package/data/examples/customize-filter-variants.tsx +116 -0
  22. package/data/examples/customize-global-filter-component.tsx +52 -0
  23. package/data/examples/customize-remove-column-grouping.tsx +94 -0
  24. package/data/examples/customize-row-selection.tsx +54 -0
  25. package/data/examples/customize-table-styles.tsx +100 -0
  26. package/data/examples/disable-column-actions.tsx +37 -0
  27. package/data/examples/disable-column-hiding.tsx +90 -0
  28. package/data/examples/disable-density-toggle.tsx +49 -0
  29. package/data/examples/dynamic-columns.tsx +189 -0
  30. package/data/examples/editing-crud-cell.tsx +377 -0
  31. package/data/examples/editing-crud-modal.tsx +370 -0
  32. package/data/examples/editing-crud-row.tsx +333 -0
  33. package/data/examples/editing-crud-table.tsx +369 -0
  34. package/data/examples/editing-crud-tree.tsx +416 -0
  35. package/data/examples/enable-cell-actions.tsx +76 -0
  36. package/data/examples/enable-click-to-copy.tsx +39 -0
  37. package/data/examples/enable-column-grouping.tsx +120 -0
  38. package/data/examples/enable-column-ordering.tsx +48 -0
  39. package/data/examples/enable-column-pinning.tsx +69 -0
  40. package/data/examples/enable-column-resizing.tsx +56 -0
  41. package/data/examples/enable-column-virtualization.tsx +27 -0
  42. package/data/examples/enable-detail-panel-conditionally.tsx +78 -0
  43. package/data/examples/enable-detail-panel-virtualized.tsx +80 -0
  44. package/data/examples/enable-expanding-tree.tsx +110 -0
  45. package/data/examples/enable-filter-facet-values.tsx +65 -0
  46. package/data/examples/enable-row-dragging.tsx +137 -0
  47. package/data/examples/enable-row-numbers-original.tsx +48 -0
  48. package/data/examples/enable-row-numbers-static.tsx +48 -0
  49. package/data/examples/enable-row-ordering.tsx +57 -0
  50. package/data/examples/enable-row-pinning-select.tsx +76 -0
  51. package/data/examples/enable-row-pinning-static.tsx +50 -0
  52. package/data/examples/enable-row-pinning-sticky.tsx +69 -0
  53. package/data/examples/enable-row-selection.tsx +96 -0
  54. package/data/examples/enable-row-virtualization.tsx +101 -0
  55. package/data/examples/enable-sticky-header.tsx +59 -0
  56. package/data/examples/expanding-tree-expanded.tsx +121 -0
  57. package/data/examples/expanding-tree-flat-parse.tsx +125 -0
  58. package/data/examples/expanding-tree-root-expanded.tsx +151 -0
  59. package/data/examples/export-to-csv.tsx +114 -0
  60. package/data/examples/export-to-pdf.tsx +104 -0
  61. package/data/examples/external-toolbar.tsx +108 -0
  62. package/data/examples/font-awesome-icons.tsx +106 -0
  63. package/data/examples/infinite-scrolling.tsx +208 -0
  64. package/data/examples/lazy-detail-panel.tsx +262 -0
  65. package/data/examples/lazy-sub-rows.tsx +190 -0
  66. package/data/examples/linear-progress.tsx +66 -0
  67. package/data/examples/loading.tsx +50 -0
  68. package/data/examples/localization-i18n-ar.tsx +65 -0
  69. package/data/examples/localization-i18n-az.tsx +60 -0
  70. package/data/examples/localization-i18n-bg.tsx +60 -0
  71. package/data/examples/localization-i18n-cs.tsx +60 -0
  72. package/data/examples/localization-i18n-da.tsx +60 -0
  73. package/data/examples/localization-i18n-de.tsx +60 -0
  74. package/data/examples/localization-i18n-el.tsx +60 -0
  75. package/data/examples/localization-i18n-en.tsx +60 -0
  76. package/data/examples/localization-i18n-es.tsx +60 -0
  77. package/data/examples/localization-i18n-et.tsx +60 -0
  78. package/data/examples/localization-i18n-fa.tsx +66 -0
  79. package/data/examples/localization-i18n-fi.tsx +60 -0
  80. package/data/examples/localization-i18n-fr.tsx +60 -0
  81. package/data/examples/localization-i18n-he.tsx +66 -0
  82. package/data/examples/localization-i18n-hr.tsx +60 -0
  83. package/data/examples/localization-i18n-hu.tsx +60 -0
  84. package/data/examples/localization-i18n-hy.tsx +65 -0
  85. package/data/examples/localization-i18n-id.tsx +60 -0
  86. package/data/examples/localization-i18n-it.tsx +60 -0
  87. package/data/examples/localization-i18n-ja.tsx +60 -0
  88. package/data/examples/localization-i18n-ko.tsx +60 -0
  89. package/data/examples/localization-i18n-nl.tsx +60 -0
  90. package/data/examples/localization-i18n-no.tsx +60 -0
  91. package/data/examples/localization-i18n-np.tsx +60 -0
  92. package/data/examples/localization-i18n-pl.tsx +60 -0
  93. package/data/examples/localization-i18n-pt-BR.tsx +60 -0
  94. package/data/examples/localization-i18n-pt.tsx +60 -0
  95. package/data/examples/localization-i18n-ro.tsx +60 -0
  96. package/data/examples/localization-i18n-ru.tsx +60 -0
  97. package/data/examples/localization-i18n-sk.tsx +60 -0
  98. package/data/examples/localization-i18n-sr-Cyrl-RS.tsx +60 -0
  99. package/data/examples/localization-i18n-sr-Latn-RS.tsx +60 -0
  100. package/data/examples/localization-i18n-sv.tsx +60 -0
  101. package/data/examples/localization-i18n-tr.tsx +60 -0
  102. package/data/examples/localization-i18n-uk.tsx +60 -0
  103. package/data/examples/localization-i18n-vi.tsx +60 -0
  104. package/data/examples/localization-i18n-zh-hans.tsx +60 -0
  105. package/data/examples/localization-i18n-zh-hant.tsx +60 -0
  106. package/data/examples/manual-selection.tsx +105 -0
  107. package/data/examples/minimal.tsx +78 -0
  108. package/data/examples/mui-theme.tsx +136 -0
  109. package/data/examples/multi-sorting.tsx +58 -0
  110. package/data/examples/persistent-state.tsx +184 -0
  111. package/data/examples/react-query.tsx +182 -0
  112. package/data/examples/remote.tsx +150 -0
  113. package/data/examples/row-actions-buttons.tsx +89 -0
  114. package/data/examples/row-actions-menu-items.tsx +64 -0
  115. package/data/examples/single-row-selection.tsx +98 -0
  116. package/data/examples/virtualized.tsx +138 -0
  117. package/data/guides/accessibility.md +119 -0
  118. package/data/guides/aggregation.md +210 -0
  119. package/data/guides/async-loading.md +132 -0
  120. package/data/guides/best-practices.md +363 -0
  121. package/data/guides/cell-actions.md +139 -0
  122. package/data/guides/click-to-copy.md +67 -0
  123. package/data/guides/column-actions.md +69 -0
  124. package/data/guides/column-filtering.md +366 -0
  125. package/data/guides/column-grouping.md +192 -0
  126. package/data/guides/column-hiding.md +133 -0
  127. package/data/guides/column-ordering-dnd.md +99 -0
  128. package/data/guides/column-pinning.md +72 -0
  129. package/data/guides/column-resizing.md +157 -0
  130. package/data/guides/column-size.md +162 -0
  131. package/data/guides/customize-components.md +395 -0
  132. package/data/guides/customize-icons.md +35 -0
  133. package/data/guides/data-columns.md +292 -0
  134. package/data/guides/density-toggle.md +46 -0
  135. package/data/guides/detail-panel.md +195 -0
  136. package/data/guides/display-columns.md +135 -0
  137. package/data/guides/editing.md +367 -0
  138. package/data/guides/expanding-sub-rows.md +194 -0
  139. package/data/guides/full-screen-toggle.md +63 -0
  140. package/data/guides/global-filtering.md +237 -0
  141. package/data/guides/localization.md +57 -0
  142. package/data/guides/memoization.md +157 -0
  143. package/data/guides/pagination.md +171 -0
  144. package/data/guides/row-actions.md +116 -0
  145. package/data/guides/row-numbers.md +24 -0
  146. package/data/guides/row-ordering-dnd.md +51 -0
  147. package/data/guides/row-pinning.md +96 -0
  148. package/data/guides/row-selection.md +237 -0
  149. package/data/guides/sorting.md +190 -0
  150. package/data/guides/state-management.md +165 -0
  151. package/data/guides/sticky-header.md +41 -0
  152. package/data/guides/table-event-listeners.md +103 -0
  153. package/data/guides/toolbar-customization.md +251 -0
  154. package/data/guides/virtualization.md +183 -0
  155. package/data/index.json +1930 -0
  156. package/data/reference/mrt-components.md +183 -0
  157. package/data/reference/mrt-hooks.md +125 -0
  158. package/data/skills/composable-components/SKILL.md +189 -0
  159. package/data/skills/customization/SKILL.md +190 -0
  160. package/data/skills/drag-and-drop-ordering/SKILL.md +227 -0
  161. package/data/skills/editing/SKILL.md +243 -0
  162. package/data/skills/filtering/SKILL.md +213 -0
  163. package/data/skills/getting-started/SKILL.md +213 -0
  164. package/data/skills/localization/SKILL.md +182 -0
  165. package/data/skills/migrate-v3-to-v4/SKILL.md +161 -0
  166. package/data/skills/state-and-server-data/SKILL.md +200 -0
  167. package/data/skills/virtualization/SKILL.md +203 -0
  168. package/dist/data.js +137 -0
  169. package/dist/index.js +232 -0
  170. package/package.json +50 -0
@@ -0,0 +1,213 @@
1
+ ---
2
+ name: getting-started
3
+ description: >
4
+ Build a Material React Table V4 with useMaterialReactTable and the MaterialReactTable table prop: install @mini_7/material-react-table with Material UI V9 peers, define stable data and MRT_ColumnDef columns, toggle features with enable* options, and read the instance. Load for a first MRT table, a Material UI data grid on TanStack Table V9, or when a TanStack useTable or upstream material-react-table example is producing the wrong setup.
5
+ metadata:
6
+ type: framework
7
+ library: '@mini_7/material-react-table'
8
+ library_version: '4.0.0'
9
+ framework: react
10
+ requires:
11
+ - '@tanstack/table-core#core'
12
+ sources:
13
+ - 'gyminii/material-react-table:apps/material-react-table-docs/pages/docs/getting-started/install.mdx'
14
+ - 'gyminii/material-react-table:apps/material-react-table-docs/pages/docs/getting-started/usage.mdx'
15
+ - 'gyminii/material-react-table:apps/material-react-table-docs/pages/docs/guides/best-practices.mdx'
16
+ - 'gyminii/material-react-table:packages/material-react-table/src/hooks/useMaterialReactTable.ts'
17
+ - 'gyminii/material-react-table:packages/material-react-table/src/types.ts'
18
+ ---
19
+
20
+ This skill builds on `@tanstack/table-core#core` for the headless model and stable inputs. Material React Table (MRT) owns the TanStack Table instance, feature registration, and all Material UI rendering. Application code never calls `useTable` or `tableFeatures`; it configures MRT options and renders MRT components.
21
+
22
+ ## Setup
23
+
24
+ ```bash
25
+ npm install @mini_7/material-react-table @mui/material@^9 @mui/icons-material@^9 @mui/x-date-pickers@^9 @emotion/react @emotion/styled
26
+ ```
27
+
28
+ Do not install `@tanstack/react-table`; MRT pins its own exact version. Node 22.12 or newer is required for the CommonJS build because TanStack Table V9 is ESM-only.
29
+
30
+ ```tsx
31
+ import { useMemo } from 'react'
32
+ import {
33
+ MaterialReactTable,
34
+ useMaterialReactTable,
35
+ type MRT_ColumnDef,
36
+ } from '@mini_7/material-react-table'
37
+
38
+ type Person = { name: string; age: number }
39
+
40
+ const data: Person[] = [
41
+ { name: 'Ada', age: 36 },
42
+ { name: 'Grace', age: 45 },
43
+ ]
44
+
45
+ export function PeopleTable() {
46
+ const columns = useMemo<MRT_ColumnDef<Person>[]>(
47
+ () => [
48
+ { accessorKey: 'name', header: 'Name' },
49
+ { accessorKey: 'age', header: 'Age' },
50
+ ],
51
+ [],
52
+ )
53
+
54
+ const table = useMaterialReactTable({
55
+ columns,
56
+ data,
57
+ enableRowSelection: true,
58
+ })
59
+
60
+ return <MaterialReactTable table={table} />
61
+ }
62
+ ```
63
+
64
+ `useMaterialReactTable(options)` returns an `MRT_TableInstance<TData>`. Every MRT component takes that instance through a `table` prop; nothing is passed through React context.
65
+
66
+ ## Core Patterns
67
+
68
+ ### Accessors return primitives, renders return markup
69
+
70
+ ```tsx
71
+ const columns: MRT_ColumnDef<Person>[] = [
72
+ {
73
+ accessorFn: (row) => `${row.firstName} ${row.lastName}`,
74
+ id: 'fullName',
75
+ header: 'Name',
76
+ Cell: ({ cell, row }) => (
77
+ <a href={row.original.profileUrl}>{cell.getValue<string>()}</a>
78
+ ),
79
+ },
80
+ ]
81
+ ```
82
+
83
+ `accessorKey` or `accessorFn` feeds sorting, filtering, grouping, and search, so it must return a string, number, boolean, or Date. `Cell`, `Header`, `Footer`, `Edit`, `Filter`, `AggregatedCell`, and `GroupedCell` are the render slots. An `accessorFn` column needs an explicit `id`.
84
+
85
+ ### Infer column types with createMRTColumnHelper
86
+
87
+ ```tsx
88
+ import { createMRTColumnHelper } from '@mini_7/material-react-table'
89
+
90
+ const helper = createMRTColumnHelper<Person>()
91
+ const columns = [
92
+ helper.accessor('name', { header: 'Name' }),
93
+ helper.accessor((row) => row.age, {
94
+ id: 'age',
95
+ header: 'Age',
96
+ Cell: ({ cell }) => cell.getValue().toLocaleString(), // typed number
97
+ }),
98
+ helper.display({ id: 'actions', header: 'Actions' }),
99
+ ]
100
+ ```
101
+
102
+ ### Toggle features with enable* options
103
+
104
+ Table-level `enable*` options switch a feature on for every column; the same option on a column definition overrides it for that column. `enableColumnFilters`, `enableSorting`, `enablePagination`, `enableGlobalFilter`, `enableColumnActions`, `enableDensityToggle`, `enableFullScreenToggle`, `enableHiding`, and `enableTopToolbar` are on by default. Row selection, editing, grouping, pinning, ordering, expanding, virtualization, and row actions are off until enabled.
105
+
106
+ ```tsx
107
+ const table = useMaterialReactTable({
108
+ columns,
109
+ data,
110
+ enableColumnOrdering: true,
111
+ enableColumnPinning: true,
112
+ enableGrouping: true,
113
+ enablePagination: false,
114
+ renderDetailPanel: ({ row }) => <pre>{JSON.stringify(row.original)}</pre>,
115
+ })
116
+ ```
117
+
118
+ ### Read the instance where you need it
119
+
120
+ ```tsx
121
+ const selectedRows = table.getSelectedRowModel().rows
122
+ const { pagination, sorting } = table.getState()
123
+ table.resetRowSelection()
124
+ ```
125
+
126
+ `table.getState()` returns the full MRT state, including MRT-only slices such as `density`, `isFullScreen`, and `showColumnFilters`. Inside render code `table.state` is the reactive equivalent.
127
+
128
+ ## Common Mistakes
129
+
130
+ ### HIGH Building the table with TanStack hooks
131
+
132
+ Wrong:
133
+
134
+ ```tsx
135
+ const table = useTable({ features, columns, data })
136
+ return <MaterialReactTable table={table} />
137
+ ```
138
+
139
+ Correct:
140
+
141
+ ```tsx
142
+ const table = useMaterialReactTable({ columns, data })
143
+ return <MaterialReactTable table={table} />
144
+ ```
145
+
146
+ `MaterialReactTable` needs the MRT instance, which registers MRT's features, display columns, localization, icons, and Material UI props. A bare TanStack instance lacks all of them.
147
+
148
+ Source: `packages/material-react-table/src/hooks/useMaterialReactTable.ts`
149
+
150
+ ### HIGH Unstable data or columns
151
+
152
+ Wrong:
153
+
154
+ ```tsx
155
+ const table = useMaterialReactTable({
156
+ columns: [{ accessorKey: 'name', header: 'Name' }],
157
+ data: response.data ?? [],
158
+ })
159
+ ```
160
+
161
+ Correct:
162
+
163
+ ```tsx
164
+ const columns = useMemo<MRT_ColumnDef<Person>[]>(() => [...], [])
165
+ const EMPTY: Person[] = []
166
+ const table = useMaterialReactTable({ columns, data: response.data ?? EMPTY })
167
+ ```
168
+
169
+ A new array each render invalidates every row model and can loop forever. Keep `columns` and `data` in `useMemo`, `useState`, module scope, or a query cache.
170
+
171
+ Source: `docs/getting-started/usage.mdx`
172
+
173
+ ### MEDIUM Mixing the upstream and fork package names
174
+
175
+ Wrong:
176
+
177
+ ```tsx
178
+ import { MaterialReactTable } from 'material-react-table'
179
+ import { MRT_Localization_DE } from '@mini_7/material-react-table/locales/de'
180
+ ```
181
+
182
+ Correct:
183
+
184
+ ```tsx
185
+ import { MaterialReactTable } from '@mini_7/material-react-table'
186
+ import { MRT_Localization_DE } from '@mini_7/material-react-table/locales/de'
187
+ ```
188
+
189
+ Two copies of MRT produce two `MRT_TableInstance` types and duplicate Emotion styles. Pick the fork everywhere, or alias `material-react-table` to it in `package.json`.
190
+
191
+ Source: `MIGRATION.md`
192
+
193
+ ### MEDIUM Returning JSX from an accessor
194
+
195
+ Wrong:
196
+
197
+ ```tsx
198
+ { accessorFn: (row) => <b>{row.name}</b>, id: 'name', header: 'Name' }
199
+ ```
200
+
201
+ Correct:
202
+
203
+ ```tsx
204
+ { accessorKey: 'name', header: 'Name', Cell: ({ cell }) => <b>{cell.getValue<string>()}</b> }
205
+ ```
206
+
207
+ Sorting, filtering, and global search compare accessor values, so JSX breaks all three.
208
+
209
+ Source: `docs/getting-started/usage.mdx`
210
+
211
+ ## API Discovery
212
+
213
+ Read `node_modules/@mini_7/material-react-table/dist/index.d.ts` for `MRT_TableOptions`, `MRT_ColumnDef`, `MRT_TableInstance`, and `MRT_TableState`; the `mui*Props`, `render*`, `enable*`, and `on*Change` option families are all declared there with JSDoc. The docs prop tables at `/docs/api/table-options`, `/docs/api/column-options`, and `/docs/api/state-options` list every option with its default and source library.
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: localization
3
+ description: >
4
+ Translate Material React Table V4 with the localization option: import a built-in locale from @mini_7/material-react-table/locales/<code>, override individual MRT_Localization strings, write a full custom locale with the language BCP 47 tag, keep {column} placeholders, and pair it with Material UI theme locales and the date pickers adapterLocale. Load for i18n, translating toolbar and menu text, number formatting in pagination, or a locale import that fails to resolve.
5
+ metadata:
6
+ type: framework
7
+ library: '@mini_7/material-react-table'
8
+ library_version: '4.0.0'
9
+ framework: react
10
+ requires:
11
+ - getting-started
12
+ sources:
13
+ - 'gyminii/material-react-table:apps/material-react-table-docs/pages/docs/guides/localization.mdx'
14
+ - 'gyminii/material-react-table:apps/material-react-table-docs/examples/localization-i18n-de/sandbox/src/TS.tsx'
15
+ - 'gyminii/material-react-table:packages/material-react-table/src/locales/en.ts'
16
+ - 'gyminii/material-react-table:packages/material-react-table/src/hooks/useMRT_TableOptions.ts'
17
+ - 'gyminii/material-react-table:packages/material-react-table/src/types.ts'
18
+ ---
19
+
20
+ This skill builds on `getting-started`. Every user-facing string MRT renders comes from one `MRT_Localization` object. The `localization` option takes a partial object that is merged over the English defaults, so a locale file or a handful of overrides both work.
21
+
22
+ ## Setup
23
+
24
+ ```tsx
25
+ import { MRT_Localization_DE } from '@mini_7/material-react-table/locales/de'
26
+
27
+ const table = useMaterialReactTable({
28
+ columns,
29
+ data,
30
+ localization: MRT_Localization_DE,
31
+ })
32
+ ```
33
+
34
+ Built-in locales, imported from `@mini_7/material-react-table/locales/<code>`: `ar`, `az`, `bg`, `cs`, `da`, `de`, `el`, `en`, `es`, `et`, `fa`, `fi`, `fr`, `he`, `hr`, `hu`, `hy`, `id`, `it`, `ja`, `ko`, `mk`, `nl`, `no`, `np`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sk`, `sr-Cyrl-RS`, `sr-Latn-RS`, `sv`, `tr`, `uk`, `vi`, `zh-Hans`, `zh-Hant`. Each exports `MRT_Localization_<CODE>` with hyphens replaced by underscores, for example `MRT_Localization_PT_BR` and `MRT_Localization_ZH_HANS`. Column headers, cell content, and your own toolbar buttons are not translated by MRT; those come from your column definitions and render slots.
35
+
36
+ ## Core Patterns
37
+
38
+ ### Override a few strings
39
+
40
+ ```tsx
41
+ const table = useMaterialReactTable({
42
+ columns,
43
+ data,
44
+ localization: {
45
+ ...MRT_Localization_DE,
46
+ noRecordsToDisplay: 'Keine Personen gefunden',
47
+ rowsPerPage: 'Personen pro Seite',
48
+ },
49
+ })
50
+ ```
51
+
52
+ Partial objects are merged over English, so an override object without a base locale still renders every other string. Keep the `localization` object stable (module scope or `useMemo`); MRT memoizes the merge on its identity.
53
+
54
+ ### Write a custom locale
55
+
56
+ ```tsx
57
+ import { type MRT_Localization } from '@mini_7/material-react-table'
58
+
59
+ export const MRT_Localization_GA: MRT_Localization = {
60
+ ...MRT_Localization_EN, // start from English so nothing is missing
61
+ language: 'ga', // BCP 47 tag used for number formatting
62
+ actions: 'Gníomhartha',
63
+ filterByColumn: 'Scag de réir {column}',
64
+ sortByColumnAsc: 'Sórtáil de réir {column} in ord ardaitheach',
65
+ noRecordsToDisplay: 'Níl aon taifid le taispeáint',
66
+ }
67
+ ```
68
+
69
+ `MRT_Localization` has around 90 keys; `language` is required on the type and feeds `toLocaleString` for the row counts in pagination and the selection banner. Strings such as `filterByColumn`, `sortByColumnAsc`, `dropToGroupBy`, and `filteringByColumn` contain `{column}` placeholders that MRT replaces with the column header, so keep the token verbatim. Fully translated locales are welcome as pull requests to `packages/material-react-table/src/locales`.
70
+
71
+ ### Pair with Material UI and the date pickers
72
+
73
+ ```tsx
74
+ import { createTheme, ThemeProvider, useTheme } from '@mui/material'
75
+ import { deDE } from '@mui/material/locale'
76
+ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
77
+ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'
78
+ import { deDE as pickersDeDE } from '@mui/x-date-pickers/locales'
79
+ import 'dayjs/locale/de'
80
+
81
+ const theme = useTheme()
82
+
83
+ <ThemeProvider theme={createTheme(theme, deDE, pickersDeDE)}>
84
+ <LocalizationProvider dateAdapter={AdapterDayjs} adapterLocale="de">
85
+ <MaterialReactTable table={table} />
86
+ </LocalizationProvider>
87
+ </ThemeProvider>
88
+ ```
89
+
90
+ MRT's `localization` covers MRT strings only. Material UI's own component text (pagination select labels, accessibility labels) comes from the theme locale, and the date and time filter pickers take their month names and formats from the pickers locale and `adapterLocale`.
91
+
92
+ ### Switch locales at runtime
93
+
94
+ ```tsx
95
+ const locales = { en: MRT_Localization_EN, de: MRT_Localization_DE, ja: MRT_Localization_JA }
96
+
97
+ const table = useMaterialReactTable({
98
+ columns,
99
+ data,
100
+ localization: locales[currentLanguage],
101
+ })
102
+ ```
103
+
104
+ The table re-renders with the new strings; no state is reset.
105
+
106
+ ## Common Mistakes
107
+
108
+ ### HIGH Importing a locale from the upstream package name
109
+
110
+ Wrong:
111
+
112
+ ```tsx
113
+ import { MRT_Localization_ES } from 'material-react-table/locales/es'
114
+ ```
115
+
116
+ Correct:
117
+
118
+ ```tsx
119
+ import { MRT_Localization_ES } from '@mini_7/material-react-table/locales/es'
120
+ ```
121
+
122
+ The fork publishes locales under its own `exports` map. The upstream path resolves only if the upstream package is also installed, which produces two copies of MRT.
123
+
124
+ Source: `MIGRATION.md`
125
+
126
+ ### MEDIUM Custom locale without the language tag
127
+
128
+ Wrong:
129
+
130
+ ```tsx
131
+ localization: { actions: 'Ações', cancel: 'Cancelar', rowsPerPage: 'Linhas por página' }
132
+ ```
133
+
134
+ Correct:
135
+
136
+ ```tsx
137
+ localization: { language: 'pt', actions: 'Ações', cancel: 'Cancelar', rowsPerPage: 'Linhas por página' }
138
+ ```
139
+
140
+ Without `language`, the English `en` tag from the merged defaults formats row counts, so `1.234` renders as `1,234`.
141
+
142
+ Source: `packages/material-react-table/src/locales/en.ts`
143
+
144
+ ### MEDIUM Dropping the {column} placeholder
145
+
146
+ Wrong:
147
+
148
+ ```tsx
149
+ localization: { filterByColumn: 'Filtrer' }
150
+ ```
151
+
152
+ Correct:
153
+
154
+ ```tsx
155
+ localization: { filterByColumn: 'Filtrer par {column}' }
156
+ ```
157
+
158
+ MRT substitutes the header into `{column}`; without it the tooltip and placeholder no longer say which column they apply to.
159
+
160
+ Source: `packages/material-react-table/src/locales/en.ts`
161
+
162
+ ### LOW Passing an unstable localization object
163
+
164
+ Wrong:
165
+
166
+ ```tsx
167
+ localization: { ...MRT_Localization_FR, noRecordsToDisplay: t('empty') }, // new object each render
168
+ ```
169
+
170
+ Correct:
171
+
172
+ ```tsx
173
+ const localization = useMemo(() => ({ ...MRT_Localization_FR, noRecordsToDisplay: t('empty') }), [t])
174
+ ```
175
+
176
+ A fresh object every render re-runs the merge and invalidates the memoized table options.
177
+
178
+ Source: `packages/material-react-table/src/hooks/useMRT_TableOptions.ts`
179
+
180
+ ## API Discovery
181
+
182
+ `MRT_Localization` in `node_modules/@mini_7/material-react-table/dist/index.d.ts` lists every key; `en.ts` in `packages/material-react-table/src/locales` is the reference translation. `ls node_modules/@mini_7/material-react-table/locales` shows the shipped locale folders. The Localization guide at `/docs/guides/localization` renders an example per locale.
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: migrate-v3-to-v4
3
+ description: >
4
+ Migrate an application from material-react-table V3 to @mini_7/material-react-table V4: switch the package and imports, upgrade Material UI and X Date Pickers to V9, move text field props to slotProps, and apply every TanStack Table V9 rename and behaviour change (column pinning start/end, columnResizing, sortFn, getPaginatedRowModel, rowSelection true values, removed getCoreRowModel options and onStateChange). Load for migration plans, implementation, or audits of a V3 codebase.
5
+ metadata:
6
+ type: lifecycle
7
+ library: '@mini_7/material-react-table'
8
+ library_version: '4.0.0'
9
+ framework: react
10
+ requires:
11
+ - getting-started
12
+ sources:
13
+ - 'gyminii/material-react-table:MIGRATION.md'
14
+ - 'gyminii/material-react-table:apps/material-react-table-docs/pages/docs/getting-started/migrating-to-v4.mdx'
15
+ - 'gyminii/material-react-table:packages/material-react-table/src/types.ts'
16
+ - 'gyminii/material-react-table:packages/material-react-table/src/hooks/useMRT_TableOptions.ts'
17
+ ---
18
+
19
+ This skill builds on `getting-started`. V4 keeps the V3 API: `useMaterialReactTable`, the `table` prop, every `mui*Props`, `render*`, and `enable*` option. Breaking changes come from three sources only: the package rename, Material UI V9, and TanStack Table V9. Do them in that order.
20
+
21
+ ## Setup
22
+
23
+ ```bash
24
+ npx @mui/codemod@latest v9.0.0/system-props src
25
+ npx @mui/codemod@latest deprecations/all src
26
+ npm uninstall material-react-table
27
+ npm install @mini_7/material-react-table @mui/material@^9 @mui/icons-material@^9 @mui/x-date-pickers@^9
28
+ ```
29
+
30
+ Then rewrite imports:
31
+
32
+ ```diff
33
+ -import { MaterialReactTable } from 'material-react-table';
34
+ -import { MRT_Localization_DE } from 'material-react-table/locales/de';
35
+ +import { MaterialReactTable } from '@mini_7/material-react-table';
36
+ +import { MRT_Localization_DE } from '@mini_7/material-react-table/locales/de';
37
+ ```
38
+
39
+ Peer floors are `@mui/material`, `@mui/icons-material`, and `@mui/x-date-pickers` at 9.0 or newer; React 18 and Emotion 11.13 are unchanged. Node 22.12 or newer is required for the CommonJS build.
40
+
41
+ ## Core Patterns
42
+
43
+ ### Renames from TanStack Table V9
44
+
45
+ Each of these is a find and replace across the codebase:
46
+
47
+ | V3 | V4 |
48
+ | --- | --- |
49
+ | `columnPinning: { left, right }` | `columnPinning: { start, end }` |
50
+ | `column.pin('left')`, `getIsPinned() === 'left'` | `column.pin('start')`, `getIsPinned() === 'start'` |
51
+ | `table.getLeftLeafColumns()`, `getRight*`, `row.getLeftVisibleCells()` | `getStartLeafColumns()`, `getEnd*`, `row.getStartVisibleCells()` |
52
+ | `columnSizingInfo`, `onColumnSizingInfoChange`, `setColumnSizingInfo` | `columnResizing`, `onColumnResizingChange`, `setColumnResizing` |
53
+ | `sortingFn`, `sortingFns`, `column.getSortingFn()` | `sortFn`, `sortFns`, `column.getSortFn()` |
54
+ | `table.getPrePaginationRowModel()`, `getPaginationRowModel()` | `getPrePaginatedRowModel()`, `getPaginatedRowModel()` |
55
+ | `column.getAggregationFn()` | `column.getAggregationFns()` |
56
+ | `MRT_SortingFn`, `MRT_ColumnSizingInfoState` | `MRT_SortFn`, `MRT_ColumnResizingState` (old names remain as deprecated aliases) |
57
+
58
+ ### Behaviour changes to audit
59
+
60
+ - `rowSelection` values are `true`, never `false`. Deselect by deleting the key.
61
+ - `rowPinning` needs both `top` and `bottom`; `columnPinning` needs both `start` and `end` when passed through `initialState` or `state`.
62
+ - `table.getIsSomeRowsSelected()` is `true` when all rows are selected. Indeterminate is `getIsSomeRowsSelected() && !getIsAllRowsSelected()`.
63
+ - A custom `aggregationFn` is `{ aggregate: (context) => value }`, not a callable. Built-in names still work.
64
+ - `getCoreRowModel`, `getFilteredRowModel`, `getSortedRowModel`, `getPaginationRowModel`, `getExpandedRowModel`, `getGroupedRowModel`, and `getFaceted*` options are gone; the models are always registered. Use `manual*` to take over a stage.
65
+ - Rows with `renderDetailPanel` report `row.getCanExpand()` as `true`. Pass `getRowCanExpand` to restrict it.
66
+ - `onStateChange` and `table.setState()` are gone. Control slices individually.
67
+ - `table.getState()` still returns the full state; `table.state` is reactive in render code.
68
+ - Pinned cells use `insetInlineStart` and `insetInlineEnd`, so RTL pins to the logical start and end.
69
+
70
+ ### Material UI V9 changes inside MRT options
71
+
72
+ ```diff
73
+ muiFilterTextFieldProps: {
74
+ - InputProps: { sx: { minWidth: 120 } },
75
+ + slotProps: { input: { sx: { minWidth: 120 } } },
76
+ },
77
+ -const pickerProps: DatePickerProps<Dayjs> = { ... };
78
+ +const pickerProps: DatePickerProps = { ... };
79
+ ```
80
+
81
+ `muiFilterDatePickerProps`, `muiFilterDateTimePickerProps`, and `muiFilterTimePickerProps` are no longer generic, and the filter pickers render `PickersTextField`, so a custom `slots.textField` must accept `PickersTextFieldProps`. Everything else in `mui*Props` passes straight to Material UI, so Material UI's own V7 and V9 notes apply.
82
+
83
+ ### Package entry points
84
+
85
+ The package ships an `exports` map with `.mjs` and `.js` builds. Only `@mini_7/material-react-table`, `@mini_7/material-react-table/locales/<code>`, and `@mini_7/material-react-table/package.json` resolve; deep imports into `dist/` or `src/` fail at build time and must be replaced with root exports.
86
+
87
+ ## Common Mistakes
88
+
89
+ ### HIGH Keeping v8 pinning literals
90
+
91
+ Wrong:
92
+
93
+ ```tsx
94
+ initialState: { columnPinning: { left: ['mrt-row-select'], right: ['mrt-row-actions'] } }
95
+ ```
96
+
97
+ Correct:
98
+
99
+ ```tsx
100
+ initialState: { columnPinning: { start: ['mrt-row-select'], end: ['mrt-row-actions'] } }
101
+ ```
102
+
103
+ `left` and `right` are no longer valid keys, so the pinning state is silently empty.
104
+
105
+ Source: `MIGRATION.md`
106
+
107
+ ### HIGH Passing row model factories
108
+
109
+ Wrong:
110
+
111
+ ```tsx
112
+ useMaterialReactTable({ columns, data, getSortedRowModel: getSortedRowModel() })
113
+ ```
114
+
115
+ Correct:
116
+
117
+ ```tsx
118
+ useMaterialReactTable({ columns, data })
119
+ ```
120
+
121
+ The options no longer exist in `MRT_TableOptions`; MRT registers every row model itself.
122
+
123
+ Source: `packages/material-react-table/src/features/mrtFeatures.ts`
124
+
125
+ ### MEDIUM Treating the migration as a TanStack useTable rewrite
126
+
127
+ Wrong:
128
+
129
+ ```tsx
130
+ const table = useTable({ features: tableFeatures({ rowSortingFeature }), columns, data })
131
+ ```
132
+
133
+ Correct:
134
+
135
+ ```tsx
136
+ const table = useMaterialReactTable({ columns, data })
137
+ ```
138
+
139
+ The `@tanstack/react-table#migrate-v8-to-v9` skill describes migrating a headless table. MRT applications stay on `useMaterialReactTable`; only the renamed instance methods and state shapes from that skill apply.
140
+
141
+ Source: `MIGRATION.md`
142
+
143
+ ### LOW Deep-importing a locale file
144
+
145
+ Wrong:
146
+
147
+ ```tsx
148
+ import { MRT_Localization_FR } from '@mini_7/material-react-table/dist/locales/fr'
149
+ ```
150
+
151
+ Correct:
152
+
153
+ ```tsx
154
+ import { MRT_Localization_FR } from '@mini_7/material-react-table/locales/fr'
155
+ ```
156
+
157
+ Source: `packages/material-react-table/package.json` exports map
158
+
159
+ ## API Discovery
160
+
161
+ Compare `node_modules/@mini_7/material-react-table/dist/index.d.ts` against the V3 declarations for renamed members; the deprecated `MRT_SortingFn` and `MRT_ColumnSizingInfoState` aliases carry JSDoc pointing to the new names. The full guide with tables is at `/docs/getting-started/migrating-to-v4`.