Skip to content

Migrating from Material React Table

If you know Material React Table (MRT) v3, most of the API carries over by name. The differences come from three places: Svelte instead of React, Svelte Material UI instead of MUI, and TanStack Table v9 instead of v8.

ReactSvelte
<MaterialReactTable table={table} /><MaterialSvelteTable {table} />
useMaterialReactTable({ ... })createMaterialSvelteTable({ ... })
useState for controlled state$state, passed to the table as a getter
renderTopToolbar, renderDetailPanelA snippet: topToolbar, detailPanel (drop render, lowercase)
Cell: ({ cell }) => <b>{...}</b>Cell is a snippet: {#snippet cell({ cell })}…{/snippet}
muiTableBodyCellPropstableBodyCellProps (drop mui)
sx / style objectsstyle strings and CSS
ref optionsThe same option names, but a { current } holder
memoModeNot needed: Svelte updates only what changed

Every renderX option became a snippet. The render prefix is gone and the name starts in lower case:

{#snippet detailPanel({ row })}
<pre>{JSON.stringify(row.original, null, 2)}</pre>
{/snippet}
<MaterialSvelteTable options={{ columns, data, detailPanel }} />

Column-level snippets keep their capital letters (Cell, Header, Footer, Edit, Filter, AggregatedCell, GroupedCell, PlaceholderCell), because header and footer are already the plain-text options.

  • renderedCellValue in a Cell snippet is the raw value, not a rendered node.
  • Menu snippets (rowActionMenuItems, columnActionsMenuItems, cellActionMenuItems) receive internalMenuItems: the built-in items as snippets, which you can render with {@render item()}.
  • createRowDialogContent and editRowDialogContent receive internalEditCells (the cells being edited). Render each with <MRT_EditCellTextField {cell} {table} />.
  • The table markup is plain <table> elements with our own CSS. SMUI provides the buttons, checkboxes, menus, dialog, switches and text fields.
  • Import material-svelte-tanstack-table/styles.css and theme with --mdc-theme-* CSS variables. There is no theme provider.
  • There are no MUI date pickers. Date, datetime and time filters use native <input type="date | datetime-local | time">. Date values reach your filter functions as Date objects (HH:mm strings for time).
  • Autocomplete filters use a native <datalist>, and tooltips use the native title attribute.

Material Svelte Table registers the v9 features, row models and function registries for you, but some names changed and they show up in your options:

v8 / MRT v3v9
sortingFn, sortingFnssortFn, sortFns
Pin 'left' / 'right''start' / 'end' (also in columnPinning state and inset-inline)
columnSizingInfo statecolumnResizing (setColumnResizing)
getState()table.atoms.<slice>.get() or table.store.get()
filterFns, sortFns, aggregationFns optionsStill options, but registered once when the table is created
arrIncludesSomeNeeds array cells. multi-select filters now default to arrIncludes
table.getPrePaginationRowModel()table.getPrePaginatedRowModel()

memoMode, MUI-specific props (sx, muiXProps) and the MUI date pickers have no equivalent. Everything else in the React docs has a counterpart under the same name.