Overview
Sensors detect and handle input events to initiate and control drag operations. The@dnd-kit/dom package includes two built-in sensors:
- PointerSensor - Handles mouse, touch, and pen interactions
- KeyboardSensor - Handles keyboard-based dragging
PointerSensor
Handles pointer events including mouse, touch, and pen input.Options
Default Behavior
The PointerSensor has intelligent defaults:Activation Constraints
Activation constraints control when a drag operation starts.PointerActivationConstraints.Delay
Requires the pointer to be held down for a duration before activating.PointerActivationConstraints.Distance
Requires the pointer to move a minimum distance before activating.Combining Constraints
Multiple constraints can be combined. The drag activates when any constraint is satisfied:KeyboardSensor
Handles keyboard-based dragging with arrow keys.Options
Default Behavior
Keyboard Movement
The KeyboardSensor supports accelerated movement:- Normal: Press arrow key to move by
offsetpixels - Fast: Hold
Shift+ arrow key to move byoffset * 5pixels
Example: Custom Sensor Configuration
Example: Touch-Optimized
Example: Mouse Only, Immediate Activation
Type Definitions
Related
- DragDropManager - Configure the manager
- Plugins - Extend functionality