AdaptTable for Mantine

Row reordering in Mantine

Compose rowReorder from @adapttable/mantine/row-reorder and a grip appears. Space lifts a row, arrows move it, Space drops it. The table never mutates your array: onRowReorder asks the host, and the host writes.

movePolicy: "confirm" opens the kit's own move menu before a drop lands. Grouped moves stay inside a group unless onGroupMove says otherwise; tree moves stay under the same parent unless onTreeMove accepts a new one. A second move cannot start while a host confirmation is still pending.

Row identity is the row key, not the visual index — a virtual window or a later page does not lie about where the row sat. The grip, the move buttons and the confirmation menu are Mantine.

The grip is a Mantine ActionIcon and the confirmation is a Mantine Menu — Space, arrows and Escape stay on the same control the rest of a Mantine table already uses.

The code

import { DataTable } from "@adapttable/mantine";
import { applyRowReorder } from "@adapttable/react";
import { rowReorder } from "@adapttable/mantine/row-reorder";

export function Tasks({ rows, setRows, columns }) {
  return (
    <DataTable
      data={rows}
      columns={columns}
      rowKey={(row) => row.id}
      features={[
        rowReorder((from, to) => {
          setRows((current) => applyRowReorder(current, from, to));
        }, { movePolicy: "confirm" }),
      ]}
    />
  );
}

Install

pnpm add @adapttable/mantine @adapttable/core @mantine/core @mantine/hooks

The same feature in the other kits

More Mantine features

Reference: row-reordering. More of this kit: AdaptTable for Mantine, or the live demo.