Skip to main content

useDraggable

Make an element draggable.

Usage

Parameters

string | number
required
Unique identifier for the draggable element. Can be a getter for reactivity.
Element
Initial element to make draggable (usually set via the ref return value)
Element
Initial drag handle element (usually set via the handleRef return value)
T
Custom data to attach to the draggable instance
boolean
Whether the draggable is disabled
Alignment
Alignment configuration for the draggable element
Plugin[]
Array of plugins to apply to this draggable
Modifier[]
Array of modifiers to transform drag coordinates
Sensor[]
Custom sensors for this draggable instance

Returns

Draggable
The draggable instance
Accessor<boolean>
Signal indicating whether this element is currently being dragged
Accessor<boolean>
Signal indicating whether this element is currently dropping
Accessor<boolean>
Signal indicating whether this element is the source of the current drag operation
(el: Element) => void
Ref setter to attach the draggable behavior to an element
(el: Element) => void
Ref setter to attach a drag handle to an element

useDroppable

Make an element droppable.

Usage

Parameters

string | number
required
Unique identifier for the droppable element. Can be a getter for reactivity.
Element
Initial element to make droppable (usually set via the ref return value)
string[]
Array of draggable types this droppable accepts
string
Type identifier for this droppable
boolean
Whether the droppable is disabled
T
Custom data to attach to the droppable instance
CollisionDetector
Custom collision detection algorithm

Returns

Droppable
The droppable instance
Accessor<boolean>
Signal indicating whether this element is currently a valid drop target
(el: Element) => void
Ref setter to attach the droppable behavior to an element

useSortable

Combine draggable and droppable functionality for sortable items.

Usage

Parameters

Includes all parameters from useDraggable and useDroppable, plus:
string | number
required
The sortable group this item belongs to. Can be a getter for reactivity.
number
required
The current index of this item in the sortable group. Should be a getter for reactivity.
Element
Optional source element for the sortable
Element
Optional target element for drop positioning
Transition
Transition configuration for sortable animations
number
Priority for collision detection when multiple droppables overlap

Returns

Sortable
The sortable instance
Accessor<boolean>
Signal indicating whether this element is currently being dragged
Accessor<boolean>
Signal indicating whether this element is currently dropping
Accessor<boolean>
Signal indicating whether this element is the source of the current drag operation
Accessor<boolean>
Signal indicating whether this element is currently a valid drop target
(el: Element) => void
Ref setter to attach the sortable behavior to an element
(el: Element) => void
Ref setter to attach a drag handle
(el: Element) => void
Ref setter to attach a source element
(el: Element) => void
Ref setter to attach a target element for drop positioning

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

Accessor<Draggable | null>
Signal for the source draggable element of the current operation
Accessor<Droppable | null>
Signal for the current drop target
Accessor<DragOperationStatus | undefined>
Signal for the status of the drag operation (idle, dragging, dropping)

useDragDropManager

Access the drag drop manager instance.

Usage

Returns

DragDropManager | undefined
The drag drop manager instance (undefined if called outside DragDropProvider)

useDeepSignal

Create a deep reactive proxy for signal-based objects.

Usage

Parameters

Accessor<T>
required
An accessor that returns the target object to track (typically contains signals)

Returns

Accessor<T>
An accessor that proxies access to the target and triggers reactivity on nested signal reads