React Chessboard UI

v
menu
hide

playerColor

To set the color of the piece that can only be played, the player’s color must be selected. If the playerColor has been selected, then the positions of the pieces of the other color can only be changed by change properties.


Typing

type playerColor = "white" | "black";

Code

const App = () => {
    return (
        <ChessBoard 
            FEN="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
            onChange={handleChange}
            onEndGame={handleEndGame}
            change={change}
            playerColor="white"
        />
    );
}

Example