DropTarget

Primitive #46

๐Ÿ” Problem it solves

When dragging an item, you need to detect valid drop targets and provide visual feedback (e.g., highlight the drop zone). Manual detection using drag events is errorโ€‘prone, especially with nested elements.

โœ… Solution

DropTarget detects when a dragged element enters, leaves, or hovers over a drop zone. It works with HTML5 native drag & drop and provides callbacks for onDragEnter, onDragLeave, and onDrop. This demo uses the libraryโ€™s implementation (with a fallback) to accept or reject drops.

๐Ÿงฉ Used by components

FileUploadZone, KanbanColumn, SortableList, TrashBin, PlaylistDropzone

๐ŸŽฎ Interactive demo