Drag and drop

Also called drag-and-drop upload or dropzone

An interaction where you pick up an item with the pointer, move it, and release it over a target, such as dropping a file onto an upload area.

What is Drag and drop?

Drag and drop has three parts: something to drag, a place to drop it, and feedback in between. While a file hovers over an upload area, the area should change (a solid colored border, a tint, a message like "Drop to upload") so people know letting go will work. After the drop, show progress and a clear success state.

Use it for file uploads, moving cards between columns on a board, reordering lists, and arranging items on a canvas. Always offer another way too, such as a Browse files button next to the dropzone and menu or keyboard actions for moving items, because dragging is hard for keyboard, screen reader, and some touch users.

For files from the computer, the browser’s drag events do the work: cancel the dragover event to allow a drop, then read event.dataTransfer.files in the drop handler. Watch out for dragleave, which also fires when the pointer moves onto a child element and makes the highlight flicker. For moving elements within a page, a library such as dnd-kit handles mouse, touch, and keyboard input.

Often confused with

Drag gesture
A drag gesture is the movement of pulling an element with a pointer or finger. Drag and drop is the whole pattern of picking something up and releasing it on a target that accepts it.
All terms

Drag gesture

Moving an element by pressing on it and sliding the pointer or finger, usually within set bounds and with a glide after release.

Drag to reorder

A list you can rearrange by dragging an item to a new spot while the other items slide aside to make room.

Progress bar

A horizontal bar that fills from left to right to show how much of a task is done, or slides in a loop while the total is still unknown.

Affordance

The visual cues that tell people what they can do with an element, like a raised button that looks pressable or a grip that says "drag me".