Skip to main content
DragOverlay is a component that renders custom content during drag operations. It provides a visual representation of the dragged item that follows the cursor, separate from the original element.

Usage

Props

ReactNode | ((source: Draggable) => ReactNode)
required
The content to render in the overlay. Can be a static React node or a function that receives the drag source and returns content.
DropAnimation | null
Customize or disable the drop animation that plays when a drag operation ends.
  • undefined β€” Use the default animation (250ms ease)
  • null β€” Disable the drop animation entirely
  • {duration, easing} β€” Customize the animation timing
  • (context) => Promise<void> | void β€” Provide a fully custom animation function
string
CSS class name to apply to the overlay container element.
React.CSSProperties
Inline styles to apply to the overlay container element.
string
default:"div"
HTML tag name for the overlay container element.
boolean | ((source: Draggable | null) => boolean)
Whether the overlay is disabled. Can be a boolean or a function that receives the drag source.

Examples

Basic Overlay

Dynamic Overlay Content

Custom Drop Animation

Overlay with No Animation

Conditional Overlay

Styled Overlay with Shadow

Multiple Overlays for Different Types

Overlay with Item Count

Type Safety

Use TypeScript generics to type the drag source:

Behavior

  • The overlay is automatically positioned to follow the cursor during drag operations
  • Children inside the overlay cannot register themselves as draggables or droppables (the manager registry is patched)
  • The overlay element has a data-dnd-overlay attribute for styling purposes
  • When the overlay is disabled or there’s no active drag, the overlay renders nothing