Row Ordering (DnD) Feature Guide
Mantine React Table has exposes all the APIs necessary to enable rich row drag and drop features that you can easily build to meet your needs. This includes the ability to reorder rows, drag rows to other tables, or drag rows to other UI in your application.
This is not the Sorting Guide which is a different feature.
Relevant Table Options
# | Prop Name | Type | Default Value | More Info Links | |
---|---|---|---|---|---|
1 | boolean |
| |||
2 | boolean |
| |||
3 | ActionIconProps | ({ row, table }) => ActionIconProps |
| Mantine ActionIcon Docs | ||
4 | OnChangeFn<MRT_Row<TData> | null> |
| |||
5 | OnChangeFn<MRT_Row<TData> | null> |
| |||
Relevant State
Enable Row Ordering
A common use for row drag and drop is to allow users to reorder rows in a table. This can be done by setting the enableRowOrdering
table option to true
, and then setting up an onDragEnd
event handler on the mantineRowDragHandleProps
table option.
Move | First Name | Last Name | City |
---|---|---|---|
Dylan | Murray | East Daphne | |
Raquel | Kohler | Columbus | |
Ervin | Reinger | South Linda | |
Brittany | McCullough | Lincoln | |
Branson | Frami | Charleston |
Drag and Drop Rows to Other UI or Tables
The Drag and Drop features are not limited to just internally within the same table. You can use them to drag rows to other UI in your application, or even to other tables. This can be done by setting the enableRowDragging
table option to true
, and then setting up an onDragEnd
event handler on the mantineRowDragHandleProps
table option to perform whatever logic you want to happen when a row is dropped.
Move | First Name | Last Name | City |
---|---|---|---|
Dylan | Murray | East Daphne | |
Raquel | Kohler | Columbus | |
Ervin | Reinger | South Linda |
Move | First Name | Last Name | City |
---|---|---|---|
Brittany | McCullough | Lincoln | |
Branson | Frami | Charleston |
View Extra Storybook Examples
Note: Drag and Drop is not currently supported on mobile touch devices.