Skip to content
Search
Search the documentation
Events
GitHub 0

Events

The argument of onconsider and onfinalize, the triggers and the sources.

How it works lists which trigger each event carries and when, and the keyboard guide explains the events of a keyboard drag.

DndEvent

The argument of onconsider and onfinalize.

type DndEvent<T = Item> = {
    items: T[];
    info: DndEventInfo<T>;
}
NameTypeDefaultDescription
itemsT[]-The items the zone should render: assign them to the zone's list.
infoDndEventInfo<T>-What happened.

DndEventInfo

What happened in a drag event: what triggered it, which item, and from which input.

interface DndEventInfo<T = Item>
NameTypeDefaultDescription
triggerTRIGGERS-The kind of drag event that took place, one of TRIGGERS.
idItemId<T>-The id of the dragged item: the value of its id key. Inferred from the item's id field, without undefined when that field is optional, since the id is required at runtime. unknown when the item type has no id field, as with a custom idKey, and for the default Item.
sourceSOURCES-The kind of input that performed the drag, one of SOURCES.

TRIGGERS

The values of info.trigger in a drag event: what made the zone receive it. The type of the same name is the union of these values.

const TRIGGERS: {
    readonly DRAG_STARTED: "dragStarted";
    readonly DRAGGED_ENTERED: "draggedEntered";
    readonly DRAGGED_ENTERED_ANOTHER: "dragEnteredAnother";
    readonly DRAGGED_OVER_INDEX: "draggedOverIndex";
    readonly DRAGGED_LEFT: "draggedLeft";
    readonly DRAGGED_LEFT_ALL: "draggedLeftAll";
    readonly DROPPED_INTO_ZONE: "droppedIntoZone";
    readonly DROPPED_INTO_ANOTHER: "droppedIntoAnother";
    readonly DROPPED_OUTSIDE_OF_ANY: "droppedOutsideOfAny";
    readonly DRAG_STOPPED: "dragStopped";
}
NameTypeDefaultDescription
DRAG_STARTED"dragStarted"-A drag started from this zone.
DRAGGED_ENTERED"draggedEntered"-The dragged item entered this zone. Only for pointer drags.
DRAGGED_ENTERED_ANOTHER"dragEnteredAnother"-Sent to the zone the drag started from when the item enters another zone. Only for pointer drags.
DRAGGED_OVER_INDEX"draggedOverIndex"-The dragged item moved over another index of this zone. Only for pointer drags.
DRAGGED_LEFT"draggedLeft"-The dragged item left this zone. Only for pointer drags.
DRAGGED_LEFT_ALL"draggedLeftAll"-Sent to the zone the drag started from when the item is outside of every zone, with the item back at its original index. Only for pointer drags.
DROPPED_INTO_ZONE"droppedIntoZone"-The item was dropped into this zone. A keyboard drag sends it each time an arrow key moves the item.
DROPPED_INTO_ANOTHER"droppedIntoAnother"-Sent to the zone the item came from when it is dropped into another zone.
DROPPED_OUTSIDE_OF_ANY"droppedOutsideOfAny"-The item was dropped outside of every zone, and goes back to the zone it came from. Only for pointer drags.
DRAG_STOPPED"dragStopped"-The user ended a keyboard drag. Only for keyboard drags.

SOURCES

The values of info.source in a drag event: the kind of input that performed the drag. The type of the same name is the union of these values.

const SOURCES: {
    readonly POINTER: "pointer";
    readonly KEYBOARD: "keyboard";
}
NameTypeDefaultDescription
POINTER"pointer"-A mouse or a touch.
KEYBOARD"keyboard"-The keyboard.

TransformDraggedElementFunction

The type of the transformDraggedElement option. During a pointer drag it receives the element that follows the pointer, the dragged item's data and the index the item would get if it were dropped now.

type TransformDraggedElementFunction<T = Item> = (element?: HTMLElement, draggedElementData?: T, index?: number) => void
Edit this page Last updated: Nov 22, 2026