TaskDnd
dnd-kit wiring for task drag sources and drop targets. Drop policy and move effects stay consumer-owned.
import {
TaskBoardColumn,
TaskBoardRoot,
TaskCard,
TaskDndProvider,
TaskDragOverlay,
TaskDraggable,
TaskDropPlaceholder,
TaskDropZone,
} from "raft-ui";
<TaskDndProvider isDropAllowed={() => true} onMove={() => {}}>
<TaskBoardRoot>
<TaskBoardColumn render={<TaskDropZone id="task-status:todo" data={{ status: "todo" }} />}>
<TaskDropPlaceholder id="task-1" placement="before" />
<TaskDraggable
id="task-1"
dropId="task-1"
dropData={{ status: "todo", taskId: "task-1" }}
>
<TaskCard />
</TaskDraggable>
<TaskDropPlaceholder id="task-1" placement="after" />
</TaskBoardColumn>
</TaskBoardRoot>
<TaskDragOverlay>
<TaskCard />
</TaskDragOverlay>
</TaskDndProvider>The demo composition passes blockedDropStatus="closed", which the board turns into an isDropAllowed policy. Drag a card onto Closed to see blocked empty-state copy; other columns accept the drop and call onMove.
disableddefault: falseboolean
Disables pointer, touch, and keyboard drag sensors.
isDropAllowed(activeId, overId, overData) => boolean
Consumer policy for whether a drop target is allowed.
onMove(details: TaskMoveDetails) => void | Promise<void>
Called when a drag ends over an allowed target.
onMoveError(error, details) => void
Called when onMove rejects.
onDragStart(event: DragStartEvent) => void
Optional hook fired when a drag starts.
onDragOver(event: DragOverEvent) => void
Optional hook fired when a draggable moves over another droppable.
onDragCancel(event: DragCancelEvent) => void
Optional hook fired when a drag is cancelled.
onDragEnd(event: DragEndEvent) => void
Optional hook fired when a drag ends.
childrenReactNode
Board or list content that participates in drag and drop.
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Disables pointer, touch, and keyboard drag sensors. |
isDropAllowed | (activeId, overId, overData) => boolean | — | Consumer policy for whether a drop target is allowed. |
onMove | (details: TaskMoveDetails) => void | Promise<void> | — | Called when a drag ends over an allowed target. |
onMoveError | (error, details) => void | — | Called when onMove rejects. |
onDragStart | (event: DragStartEvent) => void | — | Optional hook fired when a drag starts. |
onDragOver | (event: DragOverEvent) => void | — | Optional hook fired when a draggable moves over another droppable. |
onDragCancel | (event: DragCancelEvent) => void | — | Optional hook fired when a drag is cancelled. |
onDragEnd | (event: DragEndEvent) => void | — | Optional hook fired when a drag ends. |
children | ReactNode | — | Board or list content that participates in drag and drop. |
idUniqueIdentifier
Stable drag source id.
disableddefault: falseboolean
Disables dragging for this item.
dropIdUniqueIdentifier
Optional card-level drop target id for before/after insertion.
dropDataTaskDropData
Consumer metadata returned from onMove for the card-level target.
...propsComponentPropsWithRef<"div">
Draggable host. Usually wraps a TaskCard.
| Prop | Type | Default | Description |
|---|---|---|---|
id | UniqueIdentifier | — | Stable drag source id. |
disabled | boolean | false | Disables dragging for this item. |
dropId | UniqueIdentifier | — | Optional card-level drop target id for before/after insertion. |
dropData | TaskDropData | — | Consumer metadata returned from onMove for the card-level target. |
...props | ComponentPropsWithRef<"div"> | — | Draggable host. Usually wraps a TaskCard. |
idUniqueIdentifier
Stable drop target id.
disableddefault: falseboolean
Disables this drop target.
dataTaskDropData
Consumer metadata returned from onMove for this target.
...propsuseRender.ComponentProps<"div", { dropState: TaskDropState }>
Droppable host. Exposes dropState idle | allowed | blocked via render state.
| Prop | Type | Default | Description |
|---|---|---|---|
id | UniqueIdentifier | — | Stable drop target id. |
disabled | boolean | false | Disables this drop target. |
data | TaskDropData | — | Consumer metadata returned from onMove for this target. |
...props | useRender.ComponentProps<"div", { dropState: TaskDropState }> | — | Droppable host. Exposes dropState idle | allowed | blocked via render state. |
idUniqueIdentifier
The matching drop target id. Renders an allowed landing placeholder at the active card height.
placement"before" | "after"
Optional insertion edge for a card-level target.
...propsuseRender.ComponentProps<"div", { dropState: TaskDropState }>
A presentational landing slot; it is hidden unless the matching target allows the active task.
| Prop | Type | Default | Description |
|---|---|---|---|
id | UniqueIdentifier | — | The matching drop target id. Renders an allowed landing placeholder at the active card height. |
placement | "before" | "after" | — | Optional insertion edge for a card-level target. |
...props | useRender.ComponentProps<"div", { dropState: TaskDropState }> | — | A presentational landing slot; it is hidden unless the matching target allows the active task. |
childrenReactNode
Consumer-rendered drag preview. Render null when no item is active.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Consumer-rendered drag preview. Render null when no item is active. |