Skip to main content

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
Both sensors are included in the default preset.

PointerSensor

Handles pointer events including mouse, touch, and pen input.

Options

PointerSensorOptions

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.
DelayConstraintOptions

PointerActivationConstraints.Distance

Requires the pointer to move a minimum distance before activating.
DistanceConstraintOptions

Combining Constraints

Multiple constraints can be combined. The drag activates when any constraint is satisfied:

KeyboardSensor

Handles keyboard-based dragging with arrow keys.

Options

KeyboardSensorOptions

Default Behavior

Keyboard Movement

The KeyboardSensor supports accelerated movement:
  • Normal: Press arrow key to move by offset pixels
  • Fast: Hold Shift + arrow key to move by offset * 5 pixels

Example: Custom Sensor Configuration

Example: Touch-Optimized

Example: Mouse Only, Immediate Activation

Type Definitions