dragAndDrop
Press an element or point and drag it to another element or point.
The dragAndDrop command presses on a source, holds, and drags to a destination. Use it to reorder list items or move a draggable item onto a drop zone.
Parameters
| Parameter | Type | Description |
|---|---|---|
from | Map | Required. What to pick up: a selector, a point, or a selector plus a point inside it. |
to | Map | Required. Where to drop it, in the same form. |
holdDuration | Integer | Milliseconds to press before moving. Defaults to 1000. Reorder UIs lift the item only after a long press. |
duration | Integer | Milliseconds the movement takes. Defaults to 1000. Moving too fast can skip drop zones. |
A point is "x, y" in absolute pixels or percent. Without a selector it is relative to the screen. With a selector it is relative to the element.
Usage examples
Drag one element onto another:
yaml
- dragAndDrop:
from:
text: "Item A"
to:
text: "Item C"Drag between two screen points:
yaml
- dragAndDrop:
from:
point: "50%, 30%"
to:
point: "50%, 70%"
duration: 1500Platform behavior
- iOS: uses
holdDurationfor the long press.durationis not used. - Android: runs the system
input draganddropcommand, which needs Android 12 or later. The long press time is fixed by the system, so a longerholdDurationhas no effect.durationsets the movement time.
