createDraggable
Make an element draggable.Usage
Parameters
Unique identifier for the draggable element. Can be a getter for reactivity.
Custom data to attach to the draggable instance. Use a getter for reactive data.
Whether the draggable is disabled. Use a getter for reactivity.
Alignment configuration for the draggable element
Array of plugins to apply to this draggable
Array of modifiers to transform drag coordinates
Custom sensors for this draggable instance
Returns
The draggable instance
Whether this element is currently being dragged (reactive getter)
Whether this element is currently dropping (reactive getter)
Whether this element is the source of the current drag operation (reactive getter)
Svelte action to attach the draggable behavior to an element
Svelte action to attach a drag handle to an element
Example with Handle
createDroppable
Make an element droppable.Usage
Parameters
Unique identifier for the droppable element. Can be a getter for reactivity.
Array of draggable types this droppable accepts. Use a getter for reactivity.
Type identifier for this droppable
Whether the droppable is disabled. Use a getter for reactivity.
Custom data to attach to the droppable instance
Custom collision detection algorithm
Returns
The droppable instance
Whether this element is currently a valid drop target (reactive getter)
Svelte action to attach the droppable behavior to an element
createSortable
Combine draggable and droppable functionality for sortable items.Usage
Parameters
Includes all parameters fromcreateDraggable and createDroppable, plus:
The sortable group this item belongs to. Use a getter for reactivity.
The current index of this item in the sortable group. Use a getter for reactivity.
Transition configuration for sortable animations
Priority for collision detection when multiple droppables overlap
Returns
The sortable instance
Whether this element is currently being dragged (reactive getter)
Whether this element is currently dropping (reactive getter)
Whether this element is the source of the current drag operation (reactive getter)
Whether this element is currently a valid drop target (reactive getter)
Svelte action to attach the sortable behavior to an element
Svelte action to attach a drag handle
Svelte action to attach a source element
Svelte action to attach a target element for drop positioning
createDragDropMonitor
Listen to drag and drop events.Usage
Parameters
Called before drag starts. Can cancel the operation.
Called when drag operation starts
Called when the dragged element moves
Called when dragging over a droppable
Called when drag operation ends
Called when drag operation is cancelled
createDragOperation
Access the current drag operation state.Usage
Returns
The source draggable element of the current operation (reactive getter)
The current drop target (reactive getter)
The status of the drag operation (reactive getter)
getDragDropManager
Access the drag drop manager instance.Usage
Returns
The drag drop manager instance
createDeepSignal
Create a deep reactive proxy for signal-based objects.Usage
Parameters
A function that returns the target object to track (typically contains signals)
Returns
A reactive getter that proxies access to the target and triggers reactivity on nested signal reads