@lminii/material-react-table 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 (349) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +234 -0
  3. package/dist/index.d.mts +2408 -0
  4. package/dist/index.d.ts +2408 -0
  5. package/dist/index.js +4825 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +4631 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/locales/ar/index.d.mts +3 -0
  10. package/locales/ar/index.d.ts +3 -0
  11. package/locales/ar/index.js +100 -0
  12. package/locales/ar/index.mjs +96 -0
  13. package/locales/ar/package.json +6 -0
  14. package/locales/az/index.d.mts +3 -0
  15. package/locales/az/index.d.ts +3 -0
  16. package/locales/az/index.js +100 -0
  17. package/locales/az/index.mjs +96 -0
  18. package/locales/az/package.json +6 -0
  19. package/locales/bg/index.d.mts +3 -0
  20. package/locales/bg/index.d.ts +3 -0
  21. package/locales/bg/index.js +100 -0
  22. package/locales/bg/index.mjs +96 -0
  23. package/locales/bg/package.json +6 -0
  24. package/locales/cs/index.d.mts +3 -0
  25. package/locales/cs/index.d.ts +3 -0
  26. package/locales/cs/index.js +100 -0
  27. package/locales/cs/index.mjs +96 -0
  28. package/locales/cs/package.json +6 -0
  29. package/locales/da/index.d.mts +3 -0
  30. package/locales/da/index.d.ts +3 -0
  31. package/locales/da/index.js +100 -0
  32. package/locales/da/index.mjs +96 -0
  33. package/locales/da/package.json +6 -0
  34. package/locales/de/index.d.mts +3 -0
  35. package/locales/de/index.d.ts +3 -0
  36. package/locales/de/index.js +100 -0
  37. package/locales/de/index.mjs +96 -0
  38. package/locales/de/package.json +6 -0
  39. package/locales/el/index.d.mts +3 -0
  40. package/locales/el/index.d.ts +3 -0
  41. package/locales/el/index.js +100 -0
  42. package/locales/el/index.mjs +96 -0
  43. package/locales/el/package.json +6 -0
  44. package/locales/en/index.d.mts +3 -0
  45. package/locales/en/index.d.ts +3 -0
  46. package/locales/en/index.js +100 -0
  47. package/locales/en/index.mjs +96 -0
  48. package/locales/en/package.json +6 -0
  49. package/locales/es/index.d.mts +3 -0
  50. package/locales/es/index.d.ts +3 -0
  51. package/locales/es/index.js +100 -0
  52. package/locales/es/index.mjs +96 -0
  53. package/locales/es/package.json +6 -0
  54. package/locales/et/index.d.mts +3 -0
  55. package/locales/et/index.d.ts +3 -0
  56. package/locales/et/index.js +100 -0
  57. package/locales/et/index.mjs +96 -0
  58. package/locales/et/package.json +6 -0
  59. package/locales/fa/index.d.mts +3 -0
  60. package/locales/fa/index.d.ts +3 -0
  61. package/locales/fa/index.js +100 -0
  62. package/locales/fa/index.mjs +96 -0
  63. package/locales/fa/package.json +6 -0
  64. package/locales/fi/index.d.mts +3 -0
  65. package/locales/fi/index.d.ts +3 -0
  66. package/locales/fi/index.js +100 -0
  67. package/locales/fi/index.mjs +96 -0
  68. package/locales/fi/package.json +6 -0
  69. package/locales/fr/index.d.mts +3 -0
  70. package/locales/fr/index.d.ts +3 -0
  71. package/locales/fr/index.js +100 -0
  72. package/locales/fr/index.mjs +96 -0
  73. package/locales/fr/package.json +6 -0
  74. package/locales/he/index.d.mts +3 -0
  75. package/locales/he/index.d.ts +3 -0
  76. package/locales/he/index.js +100 -0
  77. package/locales/he/index.mjs +96 -0
  78. package/locales/he/package.json +6 -0
  79. package/locales/hr/index.d.mts +3 -0
  80. package/locales/hr/index.d.ts +3 -0
  81. package/locales/hr/index.js +100 -0
  82. package/locales/hr/index.mjs +96 -0
  83. package/locales/hr/package.json +6 -0
  84. package/locales/hu/index.d.mts +3 -0
  85. package/locales/hu/index.d.ts +3 -0
  86. package/locales/hu/index.js +100 -0
  87. package/locales/hu/index.mjs +96 -0
  88. package/locales/hu/package.json +6 -0
  89. package/locales/hy/index.d.mts +3 -0
  90. package/locales/hy/index.d.ts +3 -0
  91. package/locales/hy/index.js +100 -0
  92. package/locales/hy/index.mjs +96 -0
  93. package/locales/hy/package.json +6 -0
  94. package/locales/id/index.d.mts +3 -0
  95. package/locales/id/index.d.ts +3 -0
  96. package/locales/id/index.js +100 -0
  97. package/locales/id/index.mjs +96 -0
  98. package/locales/id/package.json +6 -0
  99. package/locales/it/index.d.mts +3 -0
  100. package/locales/it/index.d.ts +3 -0
  101. package/locales/it/index.js +100 -0
  102. package/locales/it/index.mjs +96 -0
  103. package/locales/it/package.json +6 -0
  104. package/locales/ja/index.d.mts +3 -0
  105. package/locales/ja/index.d.ts +3 -0
  106. package/locales/ja/index.js +100 -0
  107. package/locales/ja/index.mjs +96 -0
  108. package/locales/ja/package.json +6 -0
  109. package/locales/ko/index.d.mts +3 -0
  110. package/locales/ko/index.d.ts +3 -0
  111. package/locales/ko/index.js +100 -0
  112. package/locales/ko/index.mjs +96 -0
  113. package/locales/ko/package.json +6 -0
  114. package/locales/nl/index.d.mts +3 -0
  115. package/locales/nl/index.d.ts +3 -0
  116. package/locales/nl/index.js +100 -0
  117. package/locales/nl/index.mjs +96 -0
  118. package/locales/nl/package.json +6 -0
  119. package/locales/no/index.d.mts +3 -0
  120. package/locales/no/index.d.ts +3 -0
  121. package/locales/no/index.js +100 -0
  122. package/locales/no/index.mjs +96 -0
  123. package/locales/no/package.json +6 -0
  124. package/locales/np/index.d.mts +3 -0
  125. package/locales/np/index.d.ts +3 -0
  126. package/locales/np/index.js +100 -0
  127. package/locales/np/index.mjs +96 -0
  128. package/locales/np/package.json +6 -0
  129. package/locales/pl/index.d.mts +3 -0
  130. package/locales/pl/index.d.ts +3 -0
  131. package/locales/pl/index.js +100 -0
  132. package/locales/pl/index.mjs +96 -0
  133. package/locales/pl/package.json +6 -0
  134. package/locales/pt/index.d.mts +3 -0
  135. package/locales/pt/index.d.ts +3 -0
  136. package/locales/pt/index.js +100 -0
  137. package/locales/pt/index.mjs +96 -0
  138. package/locales/pt/package.json +6 -0
  139. package/locales/pt-BR/index.d.mts +3 -0
  140. package/locales/pt-BR/index.d.ts +3 -0
  141. package/locales/pt-BR/index.js +100 -0
  142. package/locales/pt-BR/index.mjs +96 -0
  143. package/locales/pt-BR/package.json +6 -0
  144. package/locales/ro/index.d.mts +3 -0
  145. package/locales/ro/index.d.ts +3 -0
  146. package/locales/ro/index.js +100 -0
  147. package/locales/ro/index.mjs +96 -0
  148. package/locales/ro/package.json +6 -0
  149. package/locales/ru/index.d.mts +3 -0
  150. package/locales/ru/index.d.ts +3 -0
  151. package/locales/ru/index.js +100 -0
  152. package/locales/ru/index.mjs +96 -0
  153. package/locales/ru/package.json +6 -0
  154. package/locales/sk/index.d.mts +3 -0
  155. package/locales/sk/index.d.ts +3 -0
  156. package/locales/sk/index.js +100 -0
  157. package/locales/sk/index.mjs +96 -0
  158. package/locales/sk/package.json +6 -0
  159. package/locales/sr-Cyrl-RS/index.d.mts +3 -0
  160. package/locales/sr-Cyrl-RS/index.d.ts +3 -0
  161. package/locales/sr-Cyrl-RS/index.js +100 -0
  162. package/locales/sr-Cyrl-RS/index.mjs +96 -0
  163. package/locales/sr-Cyrl-RS/package.json +6 -0
  164. package/locales/sr-Latn-RS/index.d.mts +3 -0
  165. package/locales/sr-Latn-RS/index.d.ts +3 -0
  166. package/locales/sr-Latn-RS/index.js +100 -0
  167. package/locales/sr-Latn-RS/index.mjs +96 -0
  168. package/locales/sr-Latn-RS/package.json +6 -0
  169. package/locales/sv/index.d.mts +3 -0
  170. package/locales/sv/index.d.ts +3 -0
  171. package/locales/sv/index.js +100 -0
  172. package/locales/sv/index.mjs +96 -0
  173. package/locales/sv/package.json +6 -0
  174. package/locales/tr/index.d.mts +3 -0
  175. package/locales/tr/index.d.ts +3 -0
  176. package/locales/tr/index.js +100 -0
  177. package/locales/tr/index.mjs +96 -0
  178. package/locales/tr/package.json +6 -0
  179. package/locales/uk/index.d.mts +3 -0
  180. package/locales/uk/index.d.ts +3 -0
  181. package/locales/uk/index.js +100 -0
  182. package/locales/uk/index.mjs +96 -0
  183. package/locales/uk/package.json +6 -0
  184. package/locales/vi/index.d.mts +3 -0
  185. package/locales/vi/index.d.ts +3 -0
  186. package/locales/vi/index.js +100 -0
  187. package/locales/vi/index.mjs +96 -0
  188. package/locales/vi/package.json +6 -0
  189. package/locales/zh-Hans/index.d.mts +3 -0
  190. package/locales/zh-Hans/index.d.ts +3 -0
  191. package/locales/zh-Hans/index.js +100 -0
  192. package/locales/zh-Hans/index.mjs +96 -0
  193. package/locales/zh-Hans/package.json +6 -0
  194. package/locales/zh-Hant/index.d.mts +3 -0
  195. package/locales/zh-Hant/index.d.ts +3 -0
  196. package/locales/zh-Hant/index.js +100 -0
  197. package/locales/zh-Hant/index.mjs +96 -0
  198. package/locales/zh-Hant/package.json +6 -0
  199. package/package.json +147 -0
  200. package/skills/README.md +81 -0
  201. package/skills/composable-components/SKILL.md +189 -0
  202. package/skills/customization/SKILL.md +190 -0
  203. package/skills/drag-and-drop-ordering/SKILL.md +227 -0
  204. package/skills/editing/SKILL.md +243 -0
  205. package/skills/filtering/SKILL.md +213 -0
  206. package/skills/getting-started/SKILL.md +213 -0
  207. package/skills/localization/SKILL.md +182 -0
  208. package/skills/migrate-v3-to-v4/SKILL.md +161 -0
  209. package/skills/state-and-server-data/SKILL.md +200 -0
  210. package/skills/virtualization/SKILL.md +203 -0
  211. package/src/components/MaterialReactTable.tsx +36 -0
  212. package/src/components/body/MRT_TableBody.tsx +221 -0
  213. package/src/components/body/MRT_TableBodyCell.tsx +351 -0
  214. package/src/components/body/MRT_TableBodyCellValue.tsx +130 -0
  215. package/src/components/body/MRT_TableBodyRow.tsx +288 -0
  216. package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +61 -0
  217. package/src/components/body/MRT_TableBodyRowPinButton.tsx +58 -0
  218. package/src/components/body/MRT_TableDetailPanel.tsx +110 -0
  219. package/src/components/buttons/MRT_ColumnPinningButtons.tsx +72 -0
  220. package/src/components/buttons/MRT_CopyButton.tsx +87 -0
  221. package/src/components/buttons/MRT_EditActionButtons.tsx +134 -0
  222. package/src/components/buttons/MRT_ExpandAllButton.tsx +78 -0
  223. package/src/components/buttons/MRT_ExpandButton.tsx +102 -0
  224. package/src/components/buttons/MRT_GrabHandleButton.tsx +65 -0
  225. package/src/components/buttons/MRT_RowPinButton.tsx +84 -0
  226. package/src/components/buttons/MRT_ShowHideColumnsButton.tsx +50 -0
  227. package/src/components/buttons/MRT_ToggleDensePaddingButton.tsx +52 -0
  228. package/src/components/buttons/MRT_ToggleFiltersButton.tsx +40 -0
  229. package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +51 -0
  230. package/src/components/buttons/MRT_ToggleGlobalFilterButton.tsx +46 -0
  231. package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +126 -0
  232. package/src/components/footer/MRT_TableFooter.tsx +88 -0
  233. package/src/components/footer/MRT_TableFooterCell.tsx +107 -0
  234. package/src/components/footer/MRT_TableFooterRow.tsx +95 -0
  235. package/src/components/head/MRT_TableHead.tsx +91 -0
  236. package/src/components/head/MRT_TableHeadCell.tsx +351 -0
  237. package/src/components/head/MRT_TableHeadCellColumnActionsButton.tsx +96 -0
  238. package/src/components/head/MRT_TableHeadCellFilterContainer.tsx +52 -0
  239. package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +178 -0
  240. package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +91 -0
  241. package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +96 -0
  242. package/src/components/head/MRT_TableHeadCellSortLabel.tsx +101 -0
  243. package/src/components/head/MRT_TableHeadRow.tsx +90 -0
  244. package/src/components/inputs/MRT_EditCellTextField.tsx +202 -0
  245. package/src/components/inputs/MRT_FilterCheckbox.tsx +90 -0
  246. package/src/components/inputs/MRT_FilterRangeFields.tsx +41 -0
  247. package/src/components/inputs/MRT_FilterRangeSlider.tsx +143 -0
  248. package/src/components/inputs/MRT_FilterTextField.tsx +592 -0
  249. package/src/components/inputs/MRT_GlobalFilterTextField.tsx +167 -0
  250. package/src/components/inputs/MRT_SelectCheckbox.tsx +135 -0
  251. package/src/components/menus/MRT_ActionMenuItem.tsx +62 -0
  252. package/src/components/menus/MRT_CellActionMenu.tsx +107 -0
  253. package/src/components/menus/MRT_ColumnActionMenu.tsx +352 -0
  254. package/src/components/menus/MRT_FilterOptionMenu.tsx +292 -0
  255. package/src/components/menus/MRT_RowActionMenu.tsx +88 -0
  256. package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +181 -0
  257. package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +203 -0
  258. package/src/components/modals/MRT_EditRowModal.tsx +114 -0
  259. package/src/components/table/MRT_Table.tsx +84 -0
  260. package/src/components/table/MRT_TableContainer.tsx +111 -0
  261. package/src/components/table/MRT_TableLoadingOverlay.tsx +58 -0
  262. package/src/components/table/MRT_TablePaper.tsx +89 -0
  263. package/src/components/toolbar/MRT_BottomToolbar.tsx +111 -0
  264. package/src/components/toolbar/MRT_LinearProgressBar.tsx +53 -0
  265. package/src/components/toolbar/MRT_TablePagination.tsx +241 -0
  266. package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +184 -0
  267. package/src/components/toolbar/MRT_ToolbarDropZone.tsx +83 -0
  268. package/src/components/toolbar/MRT_ToolbarInternalButtons.tsx +72 -0
  269. package/src/components/toolbar/MRT_TopToolbar.tsx +130 -0
  270. package/src/features/mrtCellActionsFeature.ts +67 -0
  271. package/src/features/mrtColumnDraggingFeature.ts +83 -0
  272. package/src/features/mrtDensityFeature.ts +64 -0
  273. package/src/features/mrtEditingFeature.ts +102 -0
  274. package/src/features/mrtFeatures.ts +103 -0
  275. package/src/features/mrtFilterModesFeature.ts +99 -0
  276. package/src/features/mrtFnsFeature.ts +46 -0
  277. package/src/features/mrtFullScreenFeature.ts +63 -0
  278. package/src/features/mrtLoadingFeature.ts +35 -0
  279. package/src/features/mrtRefsFeature.ts +60 -0
  280. package/src/features/mrtRowDraggingFeature.ts +81 -0
  281. package/src/features/mrtStateCompatFeature.ts +43 -0
  282. package/src/features/mrtToolbarsFeature.ts +76 -0
  283. package/src/fns/aggregationFns.ts +3 -0
  284. package/src/fns/filterFns.ts +196 -0
  285. package/src/fns/sortingFns.ts +31 -0
  286. package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +28 -0
  287. package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +29 -0
  288. package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +97 -0
  289. package/src/hooks/display-columns/getMRT_RowNumbersColumnDef.tsx +30 -0
  290. package/src/hooks/display-columns/getMRT_RowPinningColumnDef.tsx +24 -0
  291. package/src/hooks/display-columns/getMRT_RowSelectColumnDef.tsx +34 -0
  292. package/src/hooks/display-columns/getMRT_RowSpacerColumnDef.tsx +33 -0
  293. package/src/hooks/useMRT_ColumnVirtualizer.ts +124 -0
  294. package/src/hooks/useMRT_Effects.ts +108 -0
  295. package/src/hooks/useMRT_RowVirtualizer.ts +88 -0
  296. package/src/hooks/useMRT_Rows.ts +44 -0
  297. package/src/hooks/useMRT_TableInstance.ts +181 -0
  298. package/src/hooks/useMRT_TableOptions.ts +241 -0
  299. package/src/hooks/useMaterialReactTable.ts +12 -0
  300. package/src/icons.ts +73 -0
  301. package/src/index.ts +91 -0
  302. package/src/locales/ar.ts +97 -0
  303. package/src/locales/az.ts +97 -0
  304. package/src/locales/bg.ts +97 -0
  305. package/src/locales/cs.ts +98 -0
  306. package/src/locales/da.ts +97 -0
  307. package/src/locales/de.ts +97 -0
  308. package/src/locales/el.ts +97 -0
  309. package/src/locales/en.ts +97 -0
  310. package/src/locales/es.ts +97 -0
  311. package/src/locales/et.ts +98 -0
  312. package/src/locales/fa.ts +97 -0
  313. package/src/locales/fi.ts +98 -0
  314. package/src/locales/fr.ts +97 -0
  315. package/src/locales/he.ts +97 -0
  316. package/src/locales/hr.ts +97 -0
  317. package/src/locales/hu.ts +97 -0
  318. package/src/locales/hy.ts +97 -0
  319. package/src/locales/id.ts +98 -0
  320. package/src/locales/it.ts +97 -0
  321. package/src/locales/ja.ts +97 -0
  322. package/src/locales/ko.ts +97 -0
  323. package/src/locales/mk.ts +96 -0
  324. package/src/locales/nl.ts +97 -0
  325. package/src/locales/no.ts +99 -0
  326. package/src/locales/np.ts +98 -0
  327. package/src/locales/pl.ts +97 -0
  328. package/src/locales/pt-BR.ts +97 -0
  329. package/src/locales/pt.ts +97 -0
  330. package/src/locales/ro.ts +97 -0
  331. package/src/locales/ru.ts +97 -0
  332. package/src/locales/sk.ts +98 -0
  333. package/src/locales/sr-Cyrl-RS.ts +97 -0
  334. package/src/locales/sr-Latn-RS.ts +97 -0
  335. package/src/locales/sv.ts +97 -0
  336. package/src/locales/tr.ts +97 -0
  337. package/src/locales/uk.ts +97 -0
  338. package/src/locales/vi.ts +97 -0
  339. package/src/locales/zh-Hans.ts +96 -0
  340. package/src/locales/zh-Hant.ts +96 -0
  341. package/src/types.ts +1314 -0
  342. package/src/utils/cell.utils.ts +234 -0
  343. package/src/utils/column.utils.ts +204 -0
  344. package/src/utils/displayColumn.utils.ts +152 -0
  345. package/src/utils/row.utils.ts +258 -0
  346. package/src/utils/style.utils.ts +211 -0
  347. package/src/utils/tanstack.helpers.ts +64 -0
  348. package/src/utils/utils.ts +34 -0
  349. package/src/utils/virtualization.utils.ts +24 -0
@@ -0,0 +1,243 @@
1
+ ---
2
+ name: editing
3
+ description: >
4
+ Add create, update, and inline editing to Material React Table V4 with enableEditing, editDisplayMode (modal, row, cell, table, custom), createDisplayMode, onEditingRowSave and onCreatingRowSave with exitEditingMode, table.setEditingRow, table.setCreatingRow, muiEditTextFieldProps validation, editVariant select, and the Edit column slot. Load for CRUD tables, editable cells, row forms in a dialog, or when saved values never reach the callback.
5
+ metadata:
6
+ type: framework
7
+ library: '@lminii/material-react-table'
8
+ library_version: '4.0.0'
9
+ framework: react
10
+ requires:
11
+ - getting-started
12
+ - customization
13
+ sources:
14
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/guides/editing.mdx'
15
+ - 'lminii/material-react-table:apps/material-react-table-docs/examples/editing-crud-modal/sandbox/src/TS.tsx'
16
+ - 'lminii/material-react-table:apps/material-react-table-docs/examples/editing-crud-cell/sandbox/src/TS.tsx'
17
+ - 'lminii/material-react-table:packages/material-react-table/src/components/inputs/MRT_EditCellTextField.tsx'
18
+ - 'lminii/material-react-table:packages/material-react-table/src/types.ts'
19
+ ---
20
+
21
+ This skill builds on `getting-started` and `customization`. MRT renders the editing inputs and tracks which row or cell is being edited; persisting the values is always application code, wired through the save callbacks or the text field events.
22
+
23
+ ## Setup
24
+
25
+ ```tsx
26
+ const table = useMaterialReactTable({
27
+ columns,
28
+ data,
29
+ enableEditing: true,
30
+ editDisplayMode: 'modal', // default; also 'row' | 'cell' | 'table' | 'custom'
31
+ createDisplayMode: 'modal', // default; also 'row' | 'custom'
32
+ getRowId: (row) => row.id,
33
+ onEditingRowSave: async ({ values, table }) => {
34
+ await updateUser(values)
35
+ table.setEditingRow(null) // exit editing mode
36
+ },
37
+ onCreatingRowSave: async ({ values, table }) => {
38
+ await createUser(values)
39
+ table.setCreatingRow(null) // exit creating mode
40
+ },
41
+ renderRowActions: ({ row, table }) => (
42
+ <IconButton onClick={() => table.setEditingRow(row)}><EditIcon /></IconButton>
43
+ ),
44
+ renderTopToolbarCustomActions: ({ table }) => (
45
+ <Button onClick={() => table.setCreatingRow(true)}>Create</Button>
46
+ ),
47
+ })
48
+ ```
49
+
50
+ `enableEditing` accepts a boolean or `(row) => boolean`, on the table and on each column. Column-level `enableEditing: false` renders a disabled field in the modal and the plain cell value in the other modes. The `editingRow`, `creatingRow`, and `editingCell` state slices hold the active row or cell; `table.setEditingRow`, `table.setCreatingRow`, and `table.setEditingCell` change them.
51
+
52
+ ## Core Patterns
53
+
54
+ ### Modal and row modes save through onEditingRowSave
55
+
56
+ ```tsx
57
+ const handleSave: MRT_TableOptions<User>['onEditingRowSave'] = async ({ values, row, table, exitEditingMode }) => {
58
+ const errors = validateUser(values)
59
+ if (Object.values(errors).some(Boolean)) {
60
+ setValidationErrors(errors)
61
+ return // stay in editing mode
62
+ }
63
+ setValidationErrors({})
64
+ await updateUser({ ...row.original, ...values })
65
+ exitEditingMode() // same as table.setEditingRow(null)
66
+ }
67
+ ```
68
+
69
+ `values` is a record keyed by column id, holding the edited text of every editable column. Nothing is written to `data`; the callback owns persistence. The callback may return a promise, and the `isSaving` state slice disables the save button and shows a spinner while it is true. `onEditingRowCancel` and `onCreatingRowCancel` fire when the user closes without saving, which is where validation errors get cleared.
70
+
71
+ ### Cell and table modes save through the text field events
72
+
73
+ ```tsx
74
+ const columns: MRT_ColumnDef<User>[] = [
75
+ {
76
+ accessorKey: 'email',
77
+ header: 'Email',
78
+ muiEditTextFieldProps: ({ cell, row }) => ({
79
+ type: 'email',
80
+ required: true,
81
+ error: !!validationErrors[cell.id],
82
+ helperText: validationErrors[cell.id],
83
+ onBlur: (event) => {
84
+ const value = event.currentTarget.value
85
+ setValidationErrors((prev) => ({ ...prev, [cell.id]: validateEmail(value) ? undefined : 'Invalid email' }))
86
+ setEditedUsers((prev) => ({ ...prev, [row.id]: { ...row.original, email: value } }))
87
+ },
88
+ }),
89
+ },
90
+ ]
91
+
92
+ const table = useMaterialReactTable({
93
+ columns,
94
+ data,
95
+ enableEditing: true,
96
+ editDisplayMode: 'cell', // double-click a cell to edit it
97
+ })
98
+ ```
99
+
100
+ In `'cell'` mode a double-click opens the field for that cell; in `'table'` mode every editable cell is a field at once. `onEditingRowSave` never fires in these modes. MRT calls your `onBlur` first, then stores the value in `row._valuesCache` and clears `editingCell`, so read `event.currentTarget.value` rather than `cell.getValue()`. Enter blurs the field. For single-click editing set `muiTableBodyCellProps` with an `onClick` that calls `table.setEditingCell(cell)` and focuses `table.refs.editInputRefs.current?.[column.id]`.
101
+
102
+ ### Select inputs and custom Edit components
103
+
104
+ ```tsx
105
+ {
106
+ accessorKey: 'state',
107
+ header: 'State',
108
+ editVariant: 'select',
109
+ editSelectOptions: usStates, // string[] or { label, value }[]
110
+ muiEditTextFieldProps: { select: true, required: true },
111
+ },
112
+ {
113
+ accessorKey: 'birthday',
114
+ header: 'Birthday',
115
+ Edit: ({ cell, column, row, table }) => (
116
+ <DatePicker
117
+ value={dayjs(cell.getValue<string>())}
118
+ onChange={(date) => {
119
+ row._valuesCache[column.id] = date?.toISOString()
120
+ if (table.getState().creatingRow?.id === row.id) table.setCreatingRow(row)
121
+ else table.setEditingRow(row)
122
+ }}
123
+ />
124
+ ),
125
+ },
126
+ ```
127
+
128
+ `editSelectOptions` also accepts a callback receiving `cell`, `column`, `row`, and `table`. Select values save on change; text values save on blur. A custom `Edit` slot replaces the text field entirely, so it must write to `row._valuesCache[column.id]` and re-set the editing or creating row, otherwise the value never reaches `values` in the save callback.
129
+
130
+ ### Customize the dialog and the create row
131
+
132
+ ```tsx
133
+ import { MRT_EditActionButtons, createRow } from '@lminii/material-react-table'
134
+
135
+ const table = useMaterialReactTable({
136
+ columns,
137
+ data,
138
+ enableEditing: true,
139
+ positionCreatingRow: 'bottom', // 'top' (default), 'bottom', or a row index
140
+ renderEditRowDialogContent: ({ internalEditComponents, row, table }) => (
141
+ <>
142
+ <DialogTitle>Edit user</DialogTitle>
143
+ <DialogContent sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>{internalEditComponents}</DialogContent>
144
+ <DialogActions><MRT_EditActionButtons table={table} row={row} variant="text" /></DialogActions>
145
+ </>
146
+ ),
147
+ renderTopToolbarCustomActions: ({ table }) => (
148
+ <Button onClick={() => table.setCreatingRow(createRow(table, { id: crypto.randomUUID(), role: 'viewer' }))}>
149
+ Create with defaults
150
+ </Button>
151
+ ),
152
+ })
153
+ ```
154
+
155
+ `internalEditComponents` is the array of generated fields, one per column, so custom dialog content can reorder them or mix in other inputs. `renderCreateRowDialogContent` is the create counterpart. `table.setCreatingRow(true)` opens a blank row; `createRow(table, defaults)` seeds it. `muiEditRowDialogProps` reaches the Material UI `Dialog` itself. `editDisplayMode: 'custom'` and `createDisplayMode: 'custom'` keep the state slices and callbacks but render no MRT editing UI, for forms in a sidebar.
156
+
157
+ ## Common Mistakes
158
+
159
+ ### HIGH Forgetting to exit editing mode after saving
160
+
161
+ Wrong:
162
+
163
+ ```tsx
164
+ onEditingRowSave: async ({ values }) => {
165
+ await updateUser(values)
166
+ }
167
+ ```
168
+
169
+ Correct:
170
+
171
+ ```tsx
172
+ onEditingRowSave: async ({ values, table }) => {
173
+ await updateUser(values)
174
+ table.setEditingRow(null)
175
+ }
176
+ ```
177
+
178
+ MRT does not close the dialog or row on its own, so validation can keep it open. Call `exitEditingMode()` or `table.setEditingRow(null)` once the save succeeds, and the create counterpart `table.setCreatingRow(null)`.
179
+
180
+ Source: `docs/guides/editing.mdx`
181
+
182
+ ### HIGH Expecting the data array to update itself
183
+
184
+ Wrong:
185
+
186
+ ```tsx
187
+ editDisplayMode: 'cell',
188
+ // no muiEditTextFieldProps handlers; edits vanish after blur
189
+ ```
190
+
191
+ Correct:
192
+
193
+ ```tsx
194
+ muiEditTextFieldProps: ({ cell, row }) => ({
195
+ onBlur: (event) => saveCell(row.id, cell.column.id, event.currentTarget.value),
196
+ }),
197
+ ```
198
+
199
+ Edited text lives only in `row._valuesCache` until your code writes it to state or a server and the `data` prop changes.
200
+
201
+ Source: `packages/material-react-table/src/components/inputs/MRT_EditCellTextField.tsx`
202
+
203
+ ### MEDIUM Passing removed Material UI text field props to the editor
204
+
205
+ Wrong:
206
+
207
+ ```tsx
208
+ muiEditTextFieldProps: { InputProps: { startAdornment: <EuroIcon /> }, inputProps: { maxLength: 40 } }
209
+ ```
210
+
211
+ Correct:
212
+
213
+ ```tsx
214
+ muiEditTextFieldProps: {
215
+ slotProps: { input: { startAdornment: <EuroIcon /> }, htmlInput: { maxLength: 40 } },
216
+ }
217
+ ```
218
+
219
+ Material UI V9 removed `InputProps` and `inputProps` from `TextField`; MRT merges `slotProps.input`, `slotProps.htmlInput`, and `slotProps.select` with its own.
220
+
221
+ Source: `MIGRATION.md`
222
+
223
+ ### MEDIUM Editing without a stable row id
224
+
225
+ Wrong:
226
+
227
+ ```tsx
228
+ useMaterialReactTable({ columns, data, enableEditing: true })
229
+ ```
230
+
231
+ Correct:
232
+
233
+ ```tsx
234
+ useMaterialReactTable({ columns, data, enableEditing: true, getRowId: (row) => row.id })
235
+ ```
236
+
237
+ Without `getRowId` rows are keyed by index, so `editingRow` and `creatingRow` can point at a different record after sorting, filtering, or an optimistic insert.
238
+
239
+ Source: `docs/examples/editing-crud-modal`
240
+
241
+ ## API Discovery
242
+
243
+ Search `node_modules/@lminii/material-react-table/dist/index.d.ts` for `editDisplayMode`, `onEditingRowSave`, `onCreatingRowSave`, `_valuesCache`, and `editInputRefs` to see the exact signatures. The Editing guide at `/docs/guides/editing` lists the related table, column, and state options, and `/docs/examples/editing-crud`, `editing-crud-row`, `editing-crud-cell`, `editing-crud-table`, and `editing-crud-tree` are complete TanStack Query CRUD examples.
@@ -0,0 +1,213 @@
1
+ ---
2
+ name: filtering
3
+ description: >
4
+ Configure column and global filtering in Material React Table V4: filterVariant (text, select, multi-select, autocomplete, range, range-slider, checkbox, date, datetime, time and their ranges), enableFacetedValues, filterFn and filterFns, enableColumnFilterModes with columnFilterModeOptions, columnFilterDisplayMode, globalFilterFn and ranked results, filter match highlighting, and the muiFilter*Props. Load for dropdown or date filters, custom filter logic, filter mode menus, or search that matches the wrong rows.
5
+ metadata:
6
+ type: framework
7
+ library: '@lminii/material-react-table'
8
+ library_version: '4.0.0'
9
+ framework: react
10
+ requires:
11
+ - getting-started
12
+ - '@tanstack/table-core#column-filtering'
13
+ - '@tanstack/table-core#global-filtering'
14
+ sources:
15
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/guides/column-filtering.mdx'
16
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/guides/global-filtering.mdx'
17
+ - 'lminii/material-react-table:apps/material-react-table-docs/examples/customize-filter-variants/sandbox/src/TS.tsx'
18
+ - 'lminii/material-react-table:packages/material-react-table/src/fns/filterFns.ts'
19
+ - 'lminii/material-react-table:packages/material-react-table/src/utils/column.utils.ts'
20
+ - 'lminii/material-react-table:packages/material-react-table/src/types.ts'
21
+ ---
22
+
23
+ This skill builds on `getting-started`, `@tanstack/table-core#column-filtering`, and `@tanstack/table-core#global-filtering`. Client-side column filters and the global search are on by default. MRT adds filter inputs, filter variants, fuzzy matching, and filter mode menus on top of the TanStack filtering model; server-side filtering is covered by `state-and-server-data`.
24
+
25
+ ## Setup
26
+
27
+ ```tsx
28
+ const columns: MRT_ColumnDef<Person>[] = [
29
+ { accessorKey: 'name', header: 'Name' }, // text filter, fuzzy
30
+ { accessorKey: 'city', header: 'City', filterVariant: 'select' },
31
+ { accessorKey: 'state', header: 'State', filterVariant: 'multi-select' },
32
+ { accessorKey: 'salary', header: 'Salary', filterVariant: 'range-slider' },
33
+ {
34
+ accessorFn: (row) => new Date(row.hireDate), // filter and sort on a Date
35
+ id: 'hireDate',
36
+ header: 'Hired',
37
+ filterVariant: 'date-range',
38
+ Cell: ({ cell }) => cell.getValue<Date>().toLocaleDateString(),
39
+ },
40
+ ]
41
+
42
+ const table = useMaterialReactTable({
43
+ columns,
44
+ data,
45
+ enableFacetedValues: true, // options and min/max come from the data
46
+ initialState: { showColumnFilters: true },
47
+ })
48
+ ```
49
+
50
+ `enableColumnFilters` (table) and `enableColumnFilter` (column) turn column filters off; `enableGlobalFilter` does the same for search; `enableFilters: false` removes both. `showColumnFilters` and `showGlobalFilter` are state slices, so seed them in `initialState` to show the inputs immediately.
51
+
52
+ ## Core Patterns
53
+
54
+ ### Pick the variant and let it pick the filter function
55
+
56
+ ```tsx
57
+ { accessorKey: 'isActive', accessorFn: (row) => (row.isActive ? 'true' : 'false'), id: 'isActive', header: 'Active', filterVariant: 'checkbox' },
58
+ { accessorKey: 'age', header: 'Age', filterVariant: 'range', filterFn: 'between' },
59
+ { accessorKey: 'team', header: 'Team', filterVariant: 'autocomplete', filterSelectOptions: teams },
60
+ ```
61
+
62
+ Variants: `text` (default), `autocomplete`, `select`, `multi-select`, `range`, `range-slider`, `checkbox`, `date`, `date-range`, `datetime`, `datetime-range`, `time`, `time-range`. The default `filterFn` follows the variant: `multi-select` uses `arrIncludesSome`, any `range` variant uses `betweenInclusive`, `select` and `checkbox` use `equals`, everything else uses `fuzzy`. `filterSelectOptions` takes strings or `{ label, value }` objects; with `enableFacetedValues` the select, multi-select, autocomplete, and range-slider inputs fill themselves from the column's unique values or min and max. The checkbox variant compares against the strings `'true'` and `'false'`, so its accessor must return strings.
63
+
64
+ ### Date, datetime, and time variants need the pickers provider
65
+
66
+ ```tsx
67
+ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
68
+ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'
69
+
70
+ <LocalizationProvider dateAdapter={AdapterDayjs}>
71
+ <MaterialReactTable table={table} />
72
+ </LocalizationProvider>
73
+ ```
74
+
75
+ MRT renders `@mui/x-date-pickers` V9 components for these variants and expects one `LocalizationProvider` above the table. The accessor should return a `Date` so comparisons and sorting work. `muiFilterDatePickerProps`, `muiFilterDateTimePickerProps`, and `muiFilterTimePickerProps` forward props to the picker; for range variants the callback form receives `rangeFilterIndex` (0 for the start input, 1 for the end).
76
+
77
+ ### Custom filter functions
78
+
79
+ ```tsx
80
+ const table = useMaterialReactTable({
81
+ columns: [
82
+ { accessorKey: 'name', header: 'Name', filterFn: 'startsWith' }, // MRT built-in
83
+ { accessorKey: 'code', header: 'Code', filterFn: 'includesStringSensitive' }, // TanStack built-in
84
+ { accessorKey: 'tags', header: 'Tags', filterFn: 'hasAllTags' }, // registered below
85
+ ],
86
+ data,
87
+ filterFns: {
88
+ hasAllTags: (row, columnId, filterValue: string) =>
89
+ filterValue.split(',').every((tag) => row.getValue<string[]>(columnId).includes(tag.trim())),
90
+ },
91
+ globalFilterFn: 'contains', // default is 'fuzzy'
92
+ })
93
+ ```
94
+
95
+ MRT built-ins: `between`, `betweenInclusive`, `contains`, `empty`, `endsWith`, `equals`, `fuzzy`, `greaterThan`, `greaterThanOrEqualTo`, `lessThan`, `lessThanOrEqualTo`, `notEmpty`, `notEquals`, `startsWith`. TanStack built-ins such as `includesString`, `equalsString`, `arrIncludes`, `arrIncludesAll`, `arrIncludesSome`, `weakEquals`, and `inNumberRange` also work by name. A function passed to `filterFn` receives `(row, columnId, filterValue)` and returns a boolean; functions registered in `filterFns` become names usable in `filterFn`, `globalFilterFn`, and the filter mode menus. The `fuzzy` global filter ranks rows by match quality unless `enableGlobalFilterRankedResults` is false, a sort is active, rows are expanded, or a `manual*` option is set.
96
+
97
+ ### Let users switch filter modes
98
+
99
+ ```tsx
100
+ const table = useMaterialReactTable({
101
+ columns: [
102
+ { accessorKey: 'name', header: 'Name', columnFilterModeOptions: ['fuzzy', 'contains', 'startsWith'] },
103
+ { accessorKey: 'age', header: 'Age', columnFilterModeOptions: ['between', 'lessThan', 'greaterThan'] },
104
+ ],
105
+ data,
106
+ enableColumnFilterModes: true,
107
+ enableGlobalFilterModes: true,
108
+ globalFilterModeOptions: ['fuzzy', 'startsWith'],
109
+ columnFilterDisplayMode: 'popover', // 'subheader' (default), 'popover', or 'custom'
110
+ })
111
+ ```
112
+
113
+ The chosen modes live in the `columnFilterFns` and `globalFilterFn` state slices, controllable through `onColumnFilterFnsChange` and `onGlobalFilterFnChange`. `renderColumnFilterModeMenuItems` and `renderGlobalFilterModeMenuItems` replace the menu; each receives `onSelectFilterMode(name)` and `internalFilterOptions`. `columnFilterDisplayMode: 'custom'` keeps the filtering logic while you render inputs elsewhere with `column.setFilterValue`. Filter values arrive after a short debounce (200 ms client-side, 400 ms with `manualFiltering`).
114
+
115
+ ### Keep match highlighting in custom cells
116
+
117
+ ```tsx
118
+ {
119
+ accessorKey: 'name',
120
+ header: 'Name',
121
+ Cell: ({ renderedCellValue }) => <strong>{renderedCellValue}</strong>,
122
+ }
123
+ ```
124
+
125
+ Text filters and the global search highlight matches inside cells. A custom `Cell` keeps that only when it renders `renderedCellValue` instead of `cell.getValue()`. `enableFilterMatchHighlighting: false` turns it off per table or per column.
126
+
127
+ ## Common Mistakes
128
+
129
+ ### HIGH Filter variant does not match the accessor value type
130
+
131
+ Wrong:
132
+
133
+ ```tsx
134
+ { accessorKey: 'hireDate', header: 'Hired', filterVariant: 'date-range' } // hireDate is an ISO string
135
+ ```
136
+
137
+ Correct:
138
+
139
+ ```tsx
140
+ {
141
+ accessorFn: (row) => new Date(row.hireDate),
142
+ id: 'hireDate',
143
+ header: 'Hired',
144
+ filterVariant: 'date-range',
145
+ Cell: ({ cell }) => cell.getValue<Date>().toLocaleDateString(),
146
+ }
147
+ ```
148
+
149
+ The `betweenInclusive` comparison the date variants use works on `Date` objects and numbers, not on date strings, so string columns silently match everything or nothing.
150
+
151
+ Source: `docs/examples/customize-filter-variants`
152
+
153
+ ### HIGH Reading the filter value with the wrong shape
154
+
155
+ Wrong:
156
+
157
+ ```tsx
158
+ filterFn: (row, id, filterValue) => row.getValue<number>(id) >= filterValue, // range variant
159
+ ```
160
+
161
+ Correct:
162
+
163
+ ```tsx
164
+ filterFn: (row, id, [min, max]: [number, number]) => {
165
+ const value = row.getValue<number>(id)
166
+ return (min === '' || value >= min) && (max === '' || value <= max)
167
+ }
168
+ ```
169
+
170
+ Range variants store `[min, max]` and multi-select stores an array; text, select, and checkbox store a single value. Match the shape or the custom function throws or filters everything out.
171
+
172
+ Source: `packages/material-react-table/src/fns/filterFns.ts`
173
+
174
+ ### MEDIUM Passing removed Material UI text field props to filters
175
+
176
+ Wrong:
177
+
178
+ ```tsx
179
+ muiFilterTextFieldProps: { InputProps: { startAdornment: <SearchIcon /> } }
180
+ ```
181
+
182
+ Correct:
183
+
184
+ ```tsx
185
+ muiFilterTextFieldProps: { slotProps: { input: { startAdornment: <SearchIcon /> } } }
186
+ ```
187
+
188
+ Material UI V9 removed `InputProps` and `inputProps`; MRT merges `slotProps.input`, `slotProps.htmlInput`, and `slotProps.select` into its own.
189
+
190
+ Source: `MIGRATION.md`
191
+
192
+ ### MEDIUM Mode menu offers a function that is not registered
193
+
194
+ Wrong:
195
+
196
+ ```tsx
197
+ columnFilterModeOptions: ['fuzzy', 'isPrime'], // isPrime only exists in the column's filterFn
198
+ ```
199
+
200
+ Correct:
201
+
202
+ ```tsx
203
+ filterFns: { isPrime: (row, id) => isPrime(row.getValue<number>(id)) },
204
+ columnFilterModeOptions: ['fuzzy', 'isPrime'],
205
+ ```
206
+
207
+ Filter mode names resolve through the table `filterFns` map. A name that is not there falls back to the default and the menu label shows the raw key.
208
+
209
+ Source: `docs/guides/column-filtering.mdx`
210
+
211
+ ## API Discovery
212
+
213
+ Search `node_modules/@lminii/material-react-table/dist/index.d.ts` for `filterVariant`, `MRT_FilterOption`, `filterFns`, and `muiFilter` for the exact unions and callback props. `MRT_FilterFns` is exported for reuse. The Column Filtering and Global Filtering guides at `/docs/guides/column-filtering` and `/docs/guides/global-filtering` list the related table, column, and state options, and `/docs/examples/customize-filter-variants`, `customize-filter-modes`, `enable-filter-facet-values`, and `alternate-column-filtering` are runnable examples.
@@ -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 @lminii/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: '@lminii/material-react-table'
8
+ library_version: '4.0.0'
9
+ framework: react
10
+ requires:
11
+ - '@tanstack/table-core#core'
12
+ sources:
13
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/getting-started/install.mdx'
14
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/getting-started/usage.mdx'
15
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/guides/best-practices.mdx'
16
+ - 'lminii/material-react-table:packages/material-react-table/src/hooks/useMaterialReactTable.ts'
17
+ - 'lminii/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 @lminii/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 '@lminii/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 '@lminii/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 '@lminii/material-react-table/locales/de'
180
+ ```
181
+
182
+ Correct:
183
+
184
+ ```tsx
185
+ import { MaterialReactTable } from '@lminii/material-react-table'
186
+ import { MRT_Localization_DE } from '@lminii/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/@lminii/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.