DragDropProvider
The drag and drop context provider component.
The DragDropProvider
component is a context provider that enables drag and drop interactions within its subtree.
Usage
Location
-
Wrap your application with the
DragDropProvider
component to enable drag and drop interactions across the entire application. -
If you want to limit drag and drop interactions to a specific subtree, you can wrap only that subtree with the
DragDropProvider
component. -
You can use the
DragDropProvider
component multiple times within your application to create separate drag and drop contexts. -
You can also nest
DragDropProvider
components to create a hierarchy of drag and drop contexts.
Listening to drag and drop events
You can use the onDragStart
, onDragMove
, onDragOver
and onDragEnd
event listeners to respond to drag and drop events within the subtree of the DragDropProvider
component.
API Reference
Props
A callback that is called before a drag operation starts. Can be used to prevent the drag operation from starting by invoking event.preventDefault()
.
A callback that is called when a drag operation starts.
A callback that is called when a draggable element is moved.
A callback that is called when new collisions are detected between the draggable source and droppable targets. Invoke event.preventDefault()
to prevent the first collision from being set as the target of the drag operation.
A callback that is called when a draggable element is dragged over a droppable target.
A callback that is called when a drag operation ends.
The children of the DragDropProvider
component.
An instance of the DragDropManager
class that is used to manage the drag and drop interactions within the subtree of the DragDropProvider
component.
An array of plugins that can be used to extend the functionality of the drag and drop manager.
An array of sensors that can be used to detect user input in the browser.
An array of modifiers that can be used to modify or restrict the behavior of draggable and droppable elements.