You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 18, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+35-15Lines changed: 35 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,9 +29,11 @@ This library is still fairly new and so there is a relatively small feature set.
29
29
30
30
### Currently supported feature set
31
31
32
-
- dragging an item within a single vertical list
32
+
- vertical lists ↕
33
+
- horizontal lists ↔
33
34
- multiple independent lists on the one page
34
35
- mouse 🐭 and **keyboard 🎹** dragging
36
+
- independent nested lists (list can be a child of another list, but you cannot drag items from the parent list into a child list)
35
37
- flexible height items (the draggable items can have different heights)
36
38
- custom drag handle (you can drag a whole item by just a part of it)
37
39
- the vertical list can be a scroll container (without a scrollable parent) or be the child of a scroll container (that also does not have a scrollable parent)
@@ -227,8 +229,10 @@ Currently the keyboard handling is hard coded. This might be changed in the futu
227
229
228
230
-**tab** <kbd>tab ↹</kbd> - standard browser tabbing will navigate through the `Droppable`'s. The library does not do anything fancy with `tab` while users are selecting. Once a drag has started, `tab` is blocked for the duration of the drag.
229
231
-**spacebar** <kbd>space</kbd> - lift a focused `Draggable`. Also, drop a dragging `Draggable` where the drag was started with a `spacebar`.
230
-
-**Up arrow** <kbd>↑</kbd> - move a `Draggable` that is dragging up on a vertical list
231
-
-**Down arrow** <kbd>↓</kbd> - move a `Draggable` that is dragging down on a vertical list
232
+
-**Up arrow** <kbd>↑</kbd> - move a `Draggable` that is dragging backward in a vertical list
233
+
-**Down arrow** <kbd>↓</kbd> - move a `Draggable` that is dragging forward in a vertical list
234
+
-**Left arrow** <kbd>←</kbd> - move a `Draggable` that is dragging backward in a horizontal list
235
+
-**Right arrow** <kbd>→</kbd> - move a `Draggable` that is dragging forward in a horizontal list
232
236
-**Escape** <kbd>esc</kbd> - cancel an existing drag - regardless of whether the user is dragging with the keyboard or mouse.
233
237
234
238
#### Limitations of keyboard dragging
@@ -278,7 +282,7 @@ In order to use drag and drop, you need to have the part of your `React` tree th
@@ -322,25 +326,35 @@ These are top level application events that you can use to perform your own stat
322
326
323
327
This function will get notified when a drag starts. You are provided with the following details:
324
328
325
-
-`id`: the id of the `Draggable` that is now dragging
326
-
-`location`: the location (`droppableId` and `index`) of where the dragging item has started within a `Droppable`.
329
+
### `initial: DragStart`
330
+
331
+
-`initial.draggableId`: the id of the `Draggable` that is now dragging
332
+
-`initial.type`: the `type` of the `Draggable` that is now dragging
333
+
-`initial.source`: the location (`droppableId` and `index`) of where the dragging item has started within a `Droppable`.
327
334
328
335
This function is *optional* and therefore does not need to be provided. It is **highly recommended** that you use this function to block updates to all `Draggable` and `Droppable` components during a drag. (See *Best `hooks` practices*)
// the position of the draggable within a droppable
342
352
index: number
343
353
|};
354
+
type Id = string;
355
+
type DraggableId = Id;
356
+
type DroppableId = Id;
357
+
type TypeId = Id;
344
358
```
345
359
346
360
### `onDragEnd` (required)
@@ -349,9 +363,10 @@ This function is *extremely* important and has an critical role to play in the a
349
363
350
364
It is provided with all the information about a drag:
351
365
352
-
### `result: DragResult`
366
+
### `result: DropResult`
353
367
354
-
-`result.draggableId`: the id of the `Draggable` was dragging.
368
+
-`result.draggableId`: the id of the `Draggable` that was dragging.
369
+
-`result.type`: the `type` of the `Draggable` that was dragging.
355
370
-`result.source`: the location that the `Draggable` started in.
356
371
-`result.destination`: the location that the `Draggable` finished in. The `destination` will be `null` if the user dropped into no position (such as outside any list) *or* if they dropped the `Draggable` back into the same position that it started in.
These translations are maintained by the community and are not reviewed or maintained by the maintainers of this library. Please raise issues on the respective translations if you would like to have them updated.
892
+
873
893
## Author / maintainer
874
894
875
895
Alex Reardon - [@alexandereardon](https://twitter.com/alexandereardon) - [email protected]
0 commit comments