Skip to main content
DragDropManager is the core class that orchestrates all drag and drop operations. It manages entities, coordinates sensors and modifiers, handles collision detection, and dispatches events throughout the drag lifecycle.

Constructor

Creates a new drag and drop manager instance.
DragDropManagerInput<T, U>
Configuration object for the manager.
extends Draggable
Type parameter for draggable entities.
extends Droppable
Type parameter for droppable entities.

Properties

actions

DragActions<T, U, DragDropManager<T, U>>
Actions that can be performed during drag operations.
See DragActions for detailed action methods.

collisionObserver

CollisionObserver<T, U>
Observes and manages collision detection between draggable and droppable entities.

dragOperation

DragOperation<T, U>
Tracks the current drag operation state and metadata.

monitor

DragDropMonitor<T, U, DragDropManager<T, U>>
Monitors and emits drag and drop events.

registry

DragDropRegistry<T, U, DragDropManager<T, U>>
Registry that manages draggable and droppable entities, as well as sensors, modifiers, and plugins.

renderer

Renderer
Handles rendering of drag and drop visual feedback.

plugins

Plugin<any>[]
Gets or sets the list of active plugins.

modifiers

Modifier<any>[]
Gets or sets the list of active modifiers.

sensors

Sensor<any>[]
Gets or sets the list of active sensors.

Methods

destroy()

Cleans up resources and stops any active drag operations.
void
No return value.
This method:
  • Stops any active drag operation (marking it as canceled)
  • Destroys all active modifiers
  • Unregisters all entities
  • Cleans up the collision observer

DragActions

The actions property provides methods for controlling drag operations:

start()

Starts a new drag operation.
object
required
Configuration for the drag operation.
AbortController
An AbortController that can be used to cancel the drag operation.
Throws:
  • Error if no drag source is set
  • Error if another operation is already active
Events dispatched:
  1. beforedragstart (preventable) - Before initialization
  2. dragstart - After initialization completes

move()

Moves the dragged entity to a new position.
object
required
Configuration for the move operation.
Note: Only one of by or to should be provided. Events dispatched:
  • dragmove (preventable if cancelable is true)

stop()

Stops the current drag operation.
object
Configuration for stopping the operation.
Events dispatched:
  • dragend - With suspend() method for async cleanup

setDragSource()

Sets the source of the drag operation.
T | UniqueIdentifier
required
The draggable entity or its unique identifier.

setDropTarget()

Sets the target of the drop operation.
UniqueIdentifier | null | undefined
required
The unique identifier of the droppable entity, or null/undefined to clear the target.
Promise<boolean>
A promise that resolves to true if the dragover event was prevented.
Events dispatched:
  • dragover (preventable) - If status is dragging

Usage Examples

Basic Setup

With Plugins and Sensors

Event Handling

Manual Drag Control

Cleanup

Type Inference

You can infer draggable and droppable types from a manager:

See Also