Skip to main content
DragDropProvider is the root component that wraps your drag and drop interface. It creates a DragDropManager instance, manages sensors and plugins, and provides drag and drop context to all child components.

Usage

Props

React.ReactNode
required
The components that will use drag and drop functionality. Must include at least one draggable or droppable component.
DragDropManager
A custom DragDropManager instance. If not provided, a new instance is created automatically.
Plugin[]
Array of plugins to customize drag and drop behavior. Plugins can modify coordinates, provide feedback, or add custom functionality.
Modifier[]
Array of modifiers that transform drag coordinates during drag operations.
Sensor[]
Array of sensors that detect drag interactions. By default, includes PointerSensor and KeyboardSensor.

Event Handlers

(event: BeforeDragStartEvent, manager: DragDropManager) => void
Called before a drag operation starts. Use this to prevent or modify drag operations.
(event: DragStartEvent, manager: DragDropManager) => void
Called when a drag operation starts.
(event: DragMoveEvent, manager: DragDropManager) => void
Called continuously while dragging. Use sparingly as this fires frequently.
(event: DragOverEvent, manager: DragDropManager) => void
Called when dragging over a droppable element.
(event: DragEndEvent, manager: DragDropManager) => void
Called when a drag operation ends. This is where you typically update your application state.
(event: CollisionEvent, manager: DragDropManager) => void
Called when collision detection identifies potential drop targets.

Event Object Properties

All event handlers receive an event object with the following structure:
DragOperation
The current drag operation containing:
  • source — The draggable element being dragged
  • target — The current drop target (if any)
  • position — Current position of the drag source
  • status — Current status of the operation
boolean
Whether the drag operation was canceled (only in onDragEnd).

Complete Example

Type Parameters

DragDropProvider accepts generic type parameters for type-safe data: