Skip to main content

createDraggable

Make an element draggable.

Usage

Parameters

string | number
required
Unique identifier for the draggable element. Can be a getter for reactivity.
T
Custom data to attach to the draggable instance. Use a getter for reactive data.
boolean
Whether the draggable is disabled. Use a getter for reactivity.
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
boolean
Whether this element is currently being dragged (reactive getter)
boolean
Whether this element is currently dropping (reactive getter)
boolean
Whether this element is the source of the current drag operation (reactive getter)
(node: HTMLElement) => { destroy: () => void }
Svelte action to attach the draggable behavior to an element
(node: HTMLElement) => { destroy: () => void }
Svelte action to attach a drag handle to an element

Example with Handle


createDroppable

Make an element droppable.

Usage

Parameters

string | number
required
Unique identifier for the droppable element. Can be a getter for reactivity.
string[]
Array of draggable types this droppable accepts. Use a getter for reactivity.
string
Type identifier for this droppable
boolean
Whether the droppable is disabled. Use a getter for reactivity.
T
Custom data to attach to the droppable instance
CollisionDetector
Custom collision detection algorithm

Returns

Droppable
The droppable instance
boolean
Whether this element is currently a valid drop target (reactive getter)
(node: HTMLElement) => { destroy: () => void }
Svelte action to attach the droppable behavior to an element

createSortable

Combine draggable and droppable functionality for sortable items.

Usage

Parameters

Includes all parameters from createDraggable and createDroppable, plus:
string | number
required
The sortable group this item belongs to. Use a getter for reactivity.
number
required
The current index of this item in the sortable group. Use a getter for reactivity.
Transition
Transition configuration for sortable animations
number
Priority for collision detection when multiple droppables overlap

Returns

Sortable
The sortable instance
boolean
Whether this element is currently being dragged (reactive getter)
boolean
Whether this element is currently dropping (reactive getter)
boolean
Whether this element is the source of the current drag operation (reactive getter)
boolean
Whether this element is currently a valid drop target (reactive getter)
(node: HTMLElement) => { destroy: () => void }
Svelte action to attach the sortable behavior to an element
(node: HTMLElement) => { destroy: () => void }
Svelte action to attach a drag handle
(node: HTMLElement) => { destroy: () => void }
Svelte action to attach a source element
(node: HTMLElement) => { destroy: () => void }
Svelte action to attach a target element for drop positioning

createDragDropMonitor

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

createDragOperation

Access the current drag operation state.

Usage

Returns

Draggable | null
The source draggable element of the current operation (reactive getter)
Droppable | null
The current drop target (reactive getter)
DragOperationStatus
The status of the drag operation (reactive getter)

getDragDropManager

Access the drag drop manager instance.

Usage

Returns

DragDropManager
The drag drop manager instance

createDeepSignal

Create a deep reactive proxy for signal-based objects.

Usage

Parameters

() => T
required
A function that returns the target object to track (typically contains signals)

Returns

T
A reactive getter that proxies access to the target and triggers reactivity on nested signal reads