apps/docs/solid/components/drag-drop-provider.mdx
The DragDropProvider component is the root component for drag and drop interactions. It creates a DragDropManager instance and makes it available to all descendant components via Solid's context API.
import {DragDropProvider} from '@dnd-kit/solid';
function App() {
return (
<DragDropProvider
onDragEnd={(event) => {
// Handle drop
}}
>
</DragDropProvider>
);
}
// Add a plugin alongside defaults
plugins={(defaults) => [...defaults, MyPlugin]}
// Replace defaults entirely
plugins={[MyPlugin]}
| Prop | Description |
|---|---|
onBeforeDragStart | Called before a drag operation begins. |
onDragStart | Called when a drag operation starts. |
onDragMove | Called when the dragged element moves. |
onDragOver | Called when the dragged element moves over a droppable target. Call event.preventDefault() to prevent the default behavior of plugins that respond to this event. |
onDragEnd | Called when a drag operation ends (dropped or canceled). |
onCollision | Called when collisions are detected. |