Skip to main content

DragOverlay

Function DragOverlay 

Source
pub fn DragOverlay<T: Clone + PartialEq + 'static>(
    _: DragOverlayProps<T>,
) -> Element
Expand description

Renders its children pinned to the pointer while a drag is in flight - a custom “ghost” that follows the cursor.

Extra attributes (class, …) are forwarded to the wrapper div, so the ghost styles directly - e.g. Tailwind class: "rotate-3 scale-105 shadow-xl". A forwarded style is merged after the functional positioning rather than replacing it.

Note: the ghost follows the shared context’s pointer position, which pointer drags update on every move. Keyboard drags carry no pointer, so during one the ghost sits at the viewport origin - check dnd.mode() and skip rendering it if that matters to you.

§Props

For details, see the props struct definition.