@dnd-kit/helpers
v0.5.1
Published
[](https://npm.im/@dnd-kit/helpers)
Readme
@dnd-kit/helpers
Framework-agnostic helper functions for @dnd-kit. Provides utilities for common data transformations in drag and drop interactions.
Installation
npm install @dnd-kit/helpersAPI
| 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 |
Example
import {move} from '@dnd-kit/helpers';
function onDragEnd(event) {
items = move(items, event);
}Documentation
Visit dndkit.com for full documentation.
