createSortable API
API reference for the createSortable composable.
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| createSortable | Data |
| createDataTable | Data |
| createRegistry | Registration |
| createModel | Selection |
| useDragDrop | System |
Functions
createSortable
(_options?: SortableOptions) => SortableContext<Z, E>Create an ordered-list state primitive.
Options
disabled
MaybeRefOrGetter<boolean> | undefinedDisabled state for the entire model instance
Default: false
multiple
MaybeRefOrGetter<boolean> | undefinedAllow multiple tickets to be selected simultaneously
Default: false
Properties
selectedValues
ComputedRef<Set<E["value"] extends Ref<infer U, infer U> ? U : E["value"]>>Computed Set of selected ticket values
off
SortableEventListener<E>Methods
seek
(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => E | undefinedSeek for a ticket based on direction and optional predicate
emit
<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<E, K>) => voidEmit an event with data
batch
<R>(fn: () => R) => RExecute operations in a batch, deferring cache invalidation and event emission until complete
move
(id: ID, toIndex: number) => E | undefinedMove a ticket to a target index. Other tickets shift to fill. Emits `move:ticket` once when the index actually changes — a move whose `toIndex` already equals the ticket's current index is a no-op. No-ops when the root sortable is disabled or when the ticket is disabled.
swap
(a: ID, b: ID) => voidSwap two tickets' positions. Emits `move:ticket` twice — once per ticket. No-ops when the root sortable is disabled or when either ticket is disabled.