Overview
The@dnd-kit/dom package provides a complete DOM-based implementation of the dnd-kit drag-and-drop framework. It includes built-in sensors for pointer and keyboard interactions, plugins for accessibility and visual feedback, and high-level primitives for common use cases.
Installation
Core Exports
DragDropManager
The main orchestrator for drag-and-drop operations.Entities
Draggable- Makes elements draggableDroppable- Makes elements drop targetsSortable- Combines draggable and droppable for sortable lists
Sensors
- PointerSensor - Handles mouse, touch, and pen input
- KeyboardSensor - Handles keyboard-based dragging
Plugins
- Accessibility - Screen reader announcements and ARIA attributes
- AutoScroller - Auto-scroll when dragging near edges
- Feedback - Visual feedback during drag operations
- Cursor - Cursor styling during drag
- PreventSelection - Prevents text selection
Default Preset
TheDragDropManager includes a default preset with recommended sensors and plugins:
Events
The manager emits events throughout the drag lifecycle:Event Types
beforedragstart- Before drag initializationdragstart- Drag operation starteddragmove- Draggable position changeddragover- Dragging over a droppablecollision- Collision detected with droppabledragend- Drag operation ended
Basic Example
Package Exports
Additional Exports
The package also provides additional exports for specific use cases:/sortable- Sortable list primitives/modifiers- Position and constraint modifiers/utilities- DOM utilities and helpers/plugins/debug- Debug visualization plugin
Next Steps
DragDropManager
Configure the drag-and-drop manager
Sensors
Configure pointer and keyboard sensors
Plugins
Extend functionality with plugins
Sortable
Build sortable lists