Skip to main content

Overview

useDragOperation returns a reactive snapshot of the current drag operation’s source and target. Any component nested inside a DragDropProvider can call this hook to read live drag state and re-render whenever it changes — without subscribing to events manually. Use it when you need ambient awareness of a drag in progress (for example, to highlight a drop zone, render an overlay, or disable an unrelated UI affordance during a drag).
The hook subscribes to changes via reactive computeds, so the calling component re-renders only when source or target actually changes — not on every pointer move. If you need pointer-level updates, use useDragDropMonitor instead.

API Reference

Output

Draggable | undefined
The currently dragged Draggable instance, or undefined when no drag is in progress.
Droppable | undefined
The Droppable instance the source is currently over, or undefined if the source is not over any drop target.