The drag-and-drop pattern is used to change the order of items in a list or to move and organize items between lists. Garden’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/zendeskgarden/website/llms.txt
Use this file to discover all available pages before exploring further.
@zendeskgarden/react-draggable package is built on top of @dnd-kit/core and provides pre-styled draggable components.
Anatomy
A drag-and-drop interaction involves three core elements:- Draggable grip — the visual affordance that communicates an item can be moved
- Target placeholder — whitespace that shows where the item will land
- Draggable item being dragged — the item following the cursor
- Draggable item
- Dropzone (target area)
- Source placeholder (where the item originated)
- Active dropzone state (highlighted when a dragged item is over it)
Installation
Basic draggable item
| State | Description |
|---|---|
| Default | Communicates what is draggable via grip handle and border |
| Grabbed | Communicates the item is currently moving |
| Disabled | Communicates a non-interactive item |
Large items with nested elements
Items can contain nested interactive elements such as buttons, anchors, or form elements. When an item is tall and complex, transform it into a simpler preview while dragging rather than making it transparent.- Do
- Avoid
Provide a simplified preview of the draggable item while it is being dragged.
Placeholders and indicators
Placeholders appear during the drag interaction to show where a grabbed item can be placed.When to use each type
| Type | When to use |
|---|---|
| Empty placeholder | Most basic interactions — reordering within a single list |
| Solid grey placeholder | Moving items between multiple lists, to show source and destination |
| Target indicator | Complex layouts where you do not want to transform the layout before the item is released |
Target indicators
UseDraggable.DropIndicator in condensed layouts or when you want to show placement without shifting other items.
- Use a vertical indicator for row-direction lists (items arranged left to right)
- Use a horizontal indicator for column-direction lists (items arranged top to bottom)
Dropzones
Dropzones are locations where items can be dropped. They are communicated through dashed borders, labels, or contextual cues.Border treatment
| State | Visual style |
|---|---|
| Default (empty) | 1px grey-600 border |
| Active (item can be dropped here) | Dashed 1px blue-600 border |
| Highlighted (item is over this zone) | Solid 2px blue-600 border |
Empty vs populated dropzones
- Empty: Use borders and labels to make the dropzone discoverable. Explain how to interact with it.
- Populated: Keep it simple — show only the items inside. Remove the call-to-action.
- Always provide a label for screen readers even if it is visually hidden.
Flows
Reordering a single list
The most common drag-and-drop use case. The grip handle on each item is the interaction affordance.User grabs the item
The item enters the “grabbed” state. Empty whitespace proportional to the item appears at the current position.
Moving items between multiple lists
Used in Kanban-style layouts or builder workflows.- Highlight active dropzones while an item is being dragged
- Use highlighted styling on the dropzone the item will land in
- Use solid grey placeholders to show where the interaction started and where it will end
- Upon release, position the item at the end of the target list unless the user specified a placement
- Communicate whether the change is saved immediately or requires a page-level save action
Nesting or replacing items
Use target indicators to avoid transforming the list before release. Show the grabbed item instantly in the target location upon drop. Use text and icons to communicate intent (nesting vs. replacing).Collision algorithms
Collision algorithms control how the library detects when a draggable item is over a dropzone.| Algorithm | When to use |
|---|---|
| Closest center | Default. Recommended for most use cases, including simple sortable lists. More forgiving — allows collision without intersection. |
| Closest corner | When there are many dropzones in a condensed interface. Measures all four corners for precision. |
| Rectangle intersection | When precision is critical, such as for destructive dropzones (delete). Less forgiving, prevents accidental drops. |
Localization and internationalization
Grip handle placement
- Place the grip handle on the left for LTR languages
- Place the grip handle on the right for RTL languages
Draggable provides automatic language direction support when dir="rtl" is set.
Hidden labels
Some labels are only visible during certain parts of the interaction or are visually hidden. These labels support assistive technologies and must be translated as well.Accessibility
Keyboard controls
| Key | Action |
|---|---|
Space | Select the focused item, or release the item in a new dropzone |
↑ / ↓ | Move the grabbed item up or down within a single list |
← / → | Move the grabbed item between different lists (swap bindings for RTL) |
Esc | Cancel the move and return the item to its original position |
Screen reader announcements
Announce all states of the interaction to screen readers:- When an item receives focus
- When an item is grabbed (selected)
- When the item’s order changes
- When the item moves to a different dropzone