# dnd-kit

> Accessible drag-and-drop toolkit for React: sortable lists, kanban boards, keyboard dragging.

Source: https://tastebase.ehsanulsiam.workers.dev/browse/dnd-kit

free

Accessible drag-and-drop toolkit for React: sortable lists, kanban boards, keyboard dragging.

by Claudéric Demers[GitHub](https://github.com/clauderic/dnd-kit)[npm](https://npmjs.com/package/@dnd-kit/react)

[visit](https://dndkit.com/?utm_source=tastebase&utm_medium=referral&utm_content=detail-page)

[https://dndkit.com](https://dndkit.com/?utm_source=tastebase&utm_medium=referral&utm_content=detail-preview)

## Try these

no preview

### [Pragmatic drag and drop](https://tastebase.ehsanulsiam.workers.dev/browse/pragmatic-drag-and-drop)

Atlassian's tiny, framework-agnostic drag-and-drop built on the native HTML5 DnD API (powers Trello and Jira).

no preview

### [FormKit Drag and Drop](https://tastebase.ehsanulsiam.workers.dev/browse/formkit-drag-and-drop)

Data-first sortable lists in about 4 KB: your array is the source of truth and reorders as you drag.

no preview

### [Motion](https://tastebase.ehsanulsiam.workers.dev/browse/motion)

The default animation library for React (formerly Framer Motion): springs, gestures, layout and exit animations.

no preview

### [shadcn/ui](https://tastebase.ehsanulsiam.workers.dev/browse/shadcn-ui)

Copy-in React components on Tailwind, built on Base UI, Radix or React Aria, plus a registry CLI.

## Looks that pick it

[macOS desktopfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/macos-desktop)[Document / Notion-likefirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/document)

## For your agent

##### Install

`npm i @dnd-kit/react @dnd-kit/helpers`

##### Use it for

- drag to reorder list items or cards with keyboard and screen-reader support
- a sortable list or settings order that must work with the keyboard
- a kanban board with cards moving between columns
- reorderable dashboard widgets or a sortable grid

##### Skip it when

- dragging a divider to resize split panes or panels: the kit's Resizable part (react-resizable-panels under shadcn/ui)
- very large boards or virtualised lists in an enterprise app: pragmatic-drag-and-drop is lighter and built for scale
- a quick sortable list where data-first simplicity matters more than a11y: formkit-drag-and-drop is less code
- file upload drop zones: use the native drop event or react-dropzone

##### What's inside22 free

- DragDropProvider
- DragOverlay
- useDraggable
- useDroppable
- useSortable
- useDragDropManager
- useDragDropMonitor
- useDragOperation
- PointerSensor
- KeyboardSensor
- Accessibility
- AutoScroller
- Cursor
- Feedback
- Debug
- RestrictToHorizontalAxis
- RestrictToVerticalAxis
- RestrictToWindow
- RestrictToElement
- SnapModifier
- Collision detection
- Multiple sortable lists

##### Facts

**Frameworks**
react, vue, svelte, solid, vanilla

**Styling**
unstyled

**Weight**
small

**Accessibility**
strong

**Maturity**
stable

**License**
MIT

**Price**
Free

##### Pairs with

[Motion](https://tastebase.ehsanulsiam.workers.dev/browse/motion)[shadcn/ui](https://tastebase.ehsanulsiam.workers.dev/browse/shadcn-ui)

##### Alternatives

[Pragmatic drag and drop](https://tastebase.ehsanulsiam.workers.dev/browse/pragmatic-drag-and-drop)[FormKit Drag and Drop](https://tastebase.ehsanulsiam.workers.dev/browse/formkit-drag-and-drop)

[Compare dnd-kit with its alternatives](https://tastebase.ehsanulsiam.workers.dev/alternatives/dnd-kit-alternatives)

```
import { DragDropProvider } from '@dnd-kit/react'
import { useSortable } from '@dnd-kit/react/sortable'
import { move } from '@dnd-kit/helpers'

function Item({ id, index }: { id: string; index: number }) {
  const { ref } = useSortable({ id, index })
  return <li ref={ref}>{id}</li>
}

const [items, setItems] = useState(['a', 'b', 'c'])

<DragDropProvider onDragEnd={(event) => setItems((items) => move(items, event))}>
  <ul>{items.map((id, index) => <Item key={id} id={id} index={index} />)}</ul>
</DragDropProvider>
```

https://dndkit.com

Loading website

[Visit](https://dndkit.com/?utm_source=tastebase&utm_medium=referral&utm_content=floating-pill)
