examples/react/mantine-react-table
| Name | Last commit message | Last commit date |
|---|---|---|
| .. | ||
README.md
Mantine React Table β TanStack Table v9 example#
This example is a downloadable, self-contained adaptation of mantine-react-table v2 ported to TanStack Table v9 + Mantine v9.
The full MaRT source lives under src/mantine-react-table/ β it is a 1:1 mirror of the upstream package's src/ (components, hooks, utils, fns, locales). The demo entry point in src/main.tsx shows how to wire it up.
Differences from upstream MaRT v2#
The upstream package targets TanStack Table v8 + Mantine v7. This example has been migrated:
TanStack Table v8 β v9#
useReactTableβuseTablewithstate => stateselector.- Row models:
getCoreRowModel/getSortedRowModel/etc. options replaced with_features: stockFeaturesand_rowModels: { sortedRowModel: createSortedRowModel(sortFns), β¦ }. createRowβconstructRow(renamed v9 export).sortingFnβsortFnon column defs and theMRT_SortFntype.columnSizingInfostate βcolumnResizing(andsetColumnSizingInfoβsetColumnResizing).getPrePaginationRowModelβgetPrePaginatedRowModel.MRT_VisibilityStateβMRT_ColumnVisibilityState.table.getState()βtable.stateacross all consumer sites.- Type generics: every
MRT_*type now bindsTFeatures = StockFeaturesso consumers don't need to specify it. - State management: rebuilt on TanStack Store atoms (
useCreateAtom+useSelector) so MRT-only slices likedensityandisFullScreenare properly reactive. TanStack-aware slices (columnOrder,columnResizing,grouping,pagination) flow through the v9atomsoption.
Mantine v7 β v9#
Collapseinprop βexpanded(5 sites).@mantine/core/styles.cssimport inmain.tsx.postcss.config.cjswithpostcss-preset-mantine(required for v9 theme variables).- Tabler icons bumped to
^3.41.1.
The example uses the v9 escape-hatch useTable(opts, state => state) β every state change re-renders the consumer, matching v8 semantics. If you'd prefer fine-grained reactivity, swap the selector for narrower projections or use table.Subscribe / per-slice table.atoms.<slice>.
Running#
pnpm install
pnpm dev
Then open <http://localhost:5173>.
Caveats#
@mantine/datesis pinned to^9.1.1to match@mantine/core. If a particular MaRT date-picker filter variant misbehaves visually, the v9 picker API is broadly compatible but a few props may need tweaking β the demo doesn't include date columns, so this isn't exercised end-to-end.- The demo deliberately avoids date columns so it works even if
@mantine/dates@^9.1.1resolution becomes a problem in a future bump.
Credits#
Original library by Kevin Vandy β <https://github.com/KevinVandy/mantine-react-table>.