Skip to main content

useDraggable

Make an element draggable.

Usage

Parameters

MaybeRefOrGetter<string | number>
required
Unique identifier for the draggable element
MaybeRefOrGetter<MaybeElement>
The DOM element to make draggable. Can be a ref, component instance, or raw element.
MaybeRefOrGetter<MaybeElement>
Optional drag handle element. If provided, only this element can initiate drag.
MaybeRefOrGetter<T>
Custom data to attach to the draggable instance
MaybeRefOrGetter<boolean>
Whether the draggable is disabled
MaybeRefOrGetter<Alignment>
Alignment configuration for the draggable element
MaybeRefOrGetter<Plugin[]>
Array of plugins to apply to this draggable
MaybeRefOrGetter<Modifier[]>
Array of modifiers to transform drag coordinates
MaybeRefOrGetter<Sensor[]>
Custom sensors for this draggable instance

Returns

Readonly<Ref<Draggable>>
The draggable instance (readonly)
ComputedRef<boolean>
Whether this element is currently being dragged
ComputedRef<boolean>
Whether this element is currently dropping
ComputedRef<boolean>
Whether this element is the source of the current drag operation

useDroppable

Make an element droppable.

Usage

Parameters

MaybeRefOrGetter<string | number>
required
Unique identifier for the droppable element
MaybeRefOrGetter<MaybeElement>
The DOM element to make droppable
MaybeRefOrGetter<string[]>
Array of draggable types this droppable accepts
MaybeRefOrGetter<string>
Type identifier for this droppable
MaybeRefOrGetter<boolean>
Whether the droppable is disabled
MaybeRefOrGetter<T>
Custom data to attach to the droppable instance
MaybeRefOrGetter<CollisionDetector>
Custom collision detection algorithm

Returns

Readonly<Ref<Droppable>>
The droppable instance (readonly)
ComputedRef<boolean>
Whether this element is currently a valid drop target

useSortable

Combine draggable and droppable functionality for sortable items.

Usage

Parameters

Includes all parameters from useDraggable and useDroppable, plus:
MaybeRefOrGetter<string | number>
required
The sortable group this item belongs to
MaybeRefOrGetter<number>
required
The current index of this item in the sortable group
MaybeRefOrGetter<MaybeElement>
Optional source element for the sortable
MaybeRefOrGetter<MaybeElement>
Optional target element for drop positioning
MaybeRefOrGetter<Transition>
Transition configuration for sortable animations
MaybeRefOrGetter<number>
Priority for collision detection when multiple droppables overlap

Returns

Readonly<Ref<Sortable>>
The sortable instance (readonly)
ComputedRef<boolean>
Whether this element is currently being dragged
ComputedRef<boolean>
Whether this element is currently dropping
ComputedRef<boolean>
Whether this element is the source of the current drag operation
ComputedRef<boolean>
Whether this element is currently a valid drop target

useDragDropMonitor

Listen to drag and drop events.

Usage

Parameters

(event: BeforeDragStartEvent) => void
Called before drag starts. Can cancel the operation.
(event: DragStartEvent) => void
Called when drag operation starts
(event: DragMoveEvent) => void
Called when the dragged element moves
(event: DragOverEvent) => void
Called when dragging over a droppable
(event: DragEndEvent) => void
Called when drag operation ends
(event: DragCancelEvent) => void
Called when drag operation is cancelled

useDragOperation

Access the current drag operation state.

Usage

Returns

Draggable | null
The source draggable element of the current operation
Droppable | null
The current drop target
DragOperationStatus
The status of the drag operation (idle, dragging, dropping)

useDragDropManager

Access the drag drop manager instance.

Usage

Returns

Ref<DragDropManager>
The drag drop manager instance

useDeepSignal

Create a deep reactive proxy for signal-based objects.

Usage

Parameters

MaybeRefOrGetter<T>
required
The target object to track (typically contains signals)

Returns

ComputedRef<T>
A computed ref that proxies access to the target and triggers reactivity on nested signal reads