@dnd-kit/dom. It enables you to create drag and drop interfaces with a declarative API that integrates seamlessly with React’s component model.
Installation
Install the package using your preferred package manager:Quick Start
Create a basic drag and drop interface:Core Exports
Components
- DragDropProvider — Wraps your drag and drop interface, manages sensors, plugins, and events
- DragOverlay — Renders a custom overlay element during drag operations
Hooks
- useDraggable — Make an element draggable
- useDroppable — Create a drop target
- useSortable — Combine drag and drop with sorting
- useDragDropManager — Access the drag and drop manager instance
- useDragDropMonitor — Monitor drag and drop events
- useDragOperation — Access the current drag operation state
Type Safety
All hooks and components support custom data types through TypeScript generics:Features
- Declarative API — Use hooks and components to define drag and drop behavior
- Fine-grained reactivity — Automatic re-renders only when necessary
- TypeScript support — Full type safety with generics
- Server-side rendering — Compatible with Next.js and other SSR frameworks
- Modular architecture — Import only what you need
Next Steps
DragDropProvider
Set up your drag and drop context
useDraggable
Make elements draggable
useDroppable
Create drop targets
useSortable
Build sortable lists