Overview
The drag gesture allows elements to be dragged with pointer or touch input. Dragging can be enabled on both axes, or locked to a single axis, with constraints and momentum support.Props
drag
Enable dragging for the element.false(default): Dragging is disabledtrue: Drag in both directions"x": Drag only horizontally"y": Drag only vertically
dragConstraints
Applies constraints on the permitted draggable area.top, left, right, and bottom values (in pixels), or a ref to another element.
dragElastic
The degree of movement allowed outside constraints.0: No movement outside constraints1: Full movement- Default:
0.5
false to disable, or as an object with top/right/bottom/left values.
dragMomentum
Apply momentum from the pan gesture when dragging finishes.dragTransition
Customize the drag inertia animation.dragDirectionLock
Lock dragging to the initially-detected direction.dragPropagation
Allow drag gesture propagation to child components.dragControls
Manually control the drag gesture usinguseDragControls().
dragListener
Enable/disable automatic drag initiation on pointer down.dragSnapToOrigin
Snap back to origin when dragging ends.whileDrag
Properties or variant label to animate to while dragging.Event Handlers
onDragStart
Callback when dragging starts.onDrag
Callback while the component is being dragged.onDragEnd
Callback when dragging ends.onDirectionLock
Callback when drag direction is determined (whendragDirectionLock is enabled).