Skip to content

Chessboard Tutorial

The canonical React DnD tutorial. The knight (♘) is a BdndDraggable; every square is a BdndDropTarget whose CanDropPredicate only allows legal knight moves. While the knight is in the air, every square renders from its collected state: CanDrop alone lights the legal squares before the knight reaches them, and IsOver tells the square under the pointer. With the keyboard, Tab to the knight and press Space: the arrow keys visit the legal squares only - each named by its Label - and Space drops the knight there.

♘

Knight at column 1, row 7. Drag it to a highlighted square.

a legal square (CanDrop) a legal square under the knight (IsOver and CanDrop) a square the knight cannot go to, under it (IsOver alone)

An unhandled error has occurred. Reload 🗙