Game Callbacks

React to game events with fully typed callbacks. Play moves on the board and watch events fire in real-time in the log panel.

Active callbacks:
Event Log
Play some moves to see events appear here...
All Callbacks
<Chessboard
  onMove={(from, to, move) => {
    console.log(move.san); // "e4", "Nf3", etc.
  }}
  onCheck={(color) => {
    // color: "white" | "black"
  }}
  onGameOver={(result) => {
    // result.reason: "checkmate" | "stalemate" | "draw" | ...
    // result.winner?: "white" | "black"
  }}
  onPromotion={(from, to, piece) => {
    // piece: "q" | "r" | "b" | "n"
  }}
  onIllegalMove={(from, to) => {
    // Attempted illegal move
  }}
  onFlip={(orientation) => {
    // orientation: "white" | "black"
  }}
  onPositionChange={(fen, moves) => {
    // Called after every position update
  }}
/>