Framework-agnostic helper functions for @dnd-kit. Provides utilities for common data transformations in drag and drop interactions.
npm install @dnd-kit/helpers| Function | Description |
|---|---|
move(items, event) |
Move an item from one position to another within a flat or grouped collection |
swap(items, event) |
Swap the positions of two items |
arrayMove(array, from, to) |
Move an item in an array from one index to another |
arraySwap(array, from, to) |
Swap two items in an array by index |
import {move} from '@dnd-kit/helpers';
function onDragEnd(event) {
items = move(items, event);
}Visit dndkit.com for full documentation.