@@ -16,6 +16,7 @@ import * as CanDragPieceStories from './stories/options/CanDragPiece.stories';
1616import * as ChessboardColumnsStories from ' ./stories/options/ChessboardColumns.stories' ;
1717import * as ChessboardRowsStories from ' ./stories/options/ChessboardRows.stories' ;
1818import * as ClearArrowsOnClickStories from ' ./stories/options/ClearArrowsOnClick.stories' ;
19+ import * as ClearArrowsOnPositionChangeStories from ' ./stories/options/ClearArrowsOnPositionChange.stories' ;
1920import * as DarkSquareNotationStyleStories from ' ./stories/options/DarkSquareNotationStyle.stories' ;
2021import * as DarkSquareStyleStories from ' ./stories/options/DarkSquareStyle.stories' ;
2122import * as DragActivationDistanceStories from ' ./stories/options/DragActivationDistance.stories' ;
@@ -53,49 +54,50 @@ The component has a number of options that you can use to customise the componen
5354
5455The code for these examples can be viewed by clicking the "Show code" button in the bottom right of the interactive examples. The code can also be viewed in the [ GitHub repository] ( https://github.com/Clariity/react-chessboard/tree/main/docs/stories/options ) .
5556
56- | Option | Description |
57- | ------------------------------------------------------------ | ------------------------------------------------------------------- |
58- | [ allowAutoScroll] ( #optionsallowautoscroll ) | Controls auto-scrolling when dragging pieces near window edges |
59- | [ allowDragging] ( #optionsallowdragging ) | Controls whether pieces can be dragged on the board |
60- | [ allowDragOffBoard] ( #optionsallowdragoffboard ) | Controls whether pieces can be dragged off the board |
61- | [ allowDrawingArrows] ( #optionsallowdrawingarrows ) | Controls whether arrows can be drawn by right-clicking and dragging |
62- | [ alphaNotationStyle] ( #optionsalphanotationstyle ) | Controls styling of the alpha notation (a-h) |
63- | [ animationDurationInMs] ( #optionsanimationdurationinms ) | Controls duration of piece movement animations |
64- | [ arrows] ( #optionsarrows ) | Array of arrows to display on the board |
65- | [ arrowOptions] ( #optionsarrowoptions ) | Controls styling and behavior of arrows |
66- | [ boardOrientation] ( #optionsboardorientation ) | Sets orientation of the board ('white' or 'black') |
67- | [ boardStyle] ( #optionsboardstyle ) | Controls styling of the main board container |
68- | [ canDragPiece] ( #optionscandragpiece ) | Function to determine if a piece can be dragged |
69- | [ chessboardColumns] ( #optionschessboardcolumns ) | Number of columns on the board |
70- | [ chessboardRows] ( #optionschessboardrows ) | Number of rows on the board |
71- | [ clearArrowsOnClick] ( #optionscleararrowsonclick ) | Controls whether arrows are cleared on board click |
72- | [ darkSquareNotationStyle] ( #optionsdarksquarenotationstyle ) | Controls styling of notation on dark squares |
73- | [ darkSquareStyle] ( #optionsdarksquarestyle ) | Controls styling of dark squares |
74- | [ dragActivationDistance] ( #optionsdragactivationdistance ) | Distance in pixels before drag activation |
75- | [ draggingPieceGhostStyle] ( #optionsdraggingpieceghoststyle ) | Controls styling of ghost piece while dragging |
76- | [ draggingPieceStyle] ( #optionsdraggingpiecestyle ) | Controls styling of piece being dragged |
77- | [ dropSquareStyle] ( #optionsdropsquarestyle ) | Controls styling of squares when dragging over them |
78- | [ id] ( #optionsid ) | Sets the id of the chessboard component |
79- | [ lightSquareNotationStyle] ( #optionslightsquarenotationstyle ) | Controls styling of notation on light squares |
80- | [ lightSquareStyle] ( #optionslightsquarestyle ) | Controls styling of light squares |
81- | [ numericNotationStyle] ( #optionsnumericnotationstyle ) | Controls styling of numeric notation (1-8) |
82- | [ onArrowsChange] ( #optionsonarrowschange ) | Handler for when internal arrows change |
83- | [ onMouseOutSquare] ( #optionsonmouseoutsquare ) | Handler for mouse leaving a square |
84- | [ onMouseOverSquare] ( #optionsonmouseoversquare ) | Handler for mouse entering a square |
85- | [ onPieceClick] ( #optionsonpiececlick ) | Handler for clicking a piece |
86- | [ onPieceDrag] ( #optionsonpiecedrag ) | Handler for starting to drag a piece |
87- | [ onPieceDrop] ( #optionsonpiecedrop ) | Handler for dropping a piece |
88- | [ onSquareClick] ( #optionsonsquareclick ) | Handler for clicking a square |
89- | [ onSquareMouseDown] ( #optionsonsquaremousedown ) | Handler for mouse button down on a square |
90- | [ onSquareMouseUp] ( #optionsonsquaremouseup ) | Handler for mouse button up on a square |
91- | [ onSquareRightClick] ( #optionsonsquarerightclick ) | Handler for right-clicking a square |
92- | [ pieces] ( #optionspieces ) | Object mapping piece types to React components |
93- | [ position] ( #optionsposition ) | Current position on the board (FEN string or position object) |
94- | [ showAnimations] ( #optionsshowanimations ) | Controls whether piece movements are animated |
95- | [ showNotation] ( #optionsshownotation ) | Controls whether board notation is displayed |
96- | [ squareRenderer] ( #optionssquarerenderer ) | Controls the rendering of squares on the board |
97- | [ squareStyle] ( #optionssquarestyle ) | Base styling applied to all squares |
98- | [ squareStyles] ( #optionssquarestyles ) | Object mapping squares to custom styles |
57+ | Option | Description |
58+ | ------------------------------------------------------------------ | ------------------------------------------------------------------- |
59+ | [ allowAutoScroll] ( #optionsallowautoscroll ) | Controls auto-scrolling when dragging pieces near window edges |
60+ | [ allowDragging] ( #optionsallowdragging ) | Controls whether pieces can be dragged on the board |
61+ | [ allowDragOffBoard] ( #optionsallowdragoffboard ) | Controls whether pieces can be dragged off the board |
62+ | [ allowDrawingArrows] ( #optionsallowdrawingarrows ) | Controls whether arrows can be drawn by right-clicking and dragging |
63+ | [ alphaNotationStyle] ( #optionsalphanotationstyle ) | Controls styling of the alpha notation (a-h) |
64+ | [ animationDurationInMs] ( #optionsanimationdurationinms ) | Controls duration of piece movement animations |
65+ | [ arrows] ( #optionsarrows ) | Array of arrows to display on the board |
66+ | [ arrowOptions] ( #optionsarrowoptions ) | Controls styling and behavior of arrows |
67+ | [ boardOrientation] ( #optionsboardorientation ) | Sets orientation of the board ('white' or 'black') |
68+ | [ boardStyle] ( #optionsboardstyle ) | Controls styling of the main board container |
69+ | [ canDragPiece] ( #optionscandragpiece ) | Function to determine if a piece can be dragged |
70+ | [ chessboardColumns] ( #optionschessboardcolumns ) | Number of columns on the board |
71+ | [ chessboardRows] ( #optionschessboardrows ) | Number of rows on the board |
72+ | [ clearArrowsOnClick] ( #optionscleararrowsonclick ) | Controls whether arrows are cleared on board click |
73+ | [ clearArrowsOnPositionChange] ( #optionscleararrowsonpositionchange ) | Controls whether arrows are cleared on position change |
74+ | [ darkSquareNotationStyle] ( #optionsdarksquarenotationstyle ) | Controls styling of notation on dark squares |
75+ | [ darkSquareStyle] ( #optionsdarksquarestyle ) | Controls styling of dark squares |
76+ | [ dragActivationDistance] ( #optionsdragactivationdistance ) | Distance in pixels before drag activation |
77+ | [ draggingPieceGhostStyle] ( #optionsdraggingpieceghoststyle ) | Controls styling of ghost piece while dragging |
78+ | [ draggingPieceStyle] ( #optionsdraggingpiecestyle ) | Controls styling of piece being dragged |
79+ | [ dropSquareStyle] ( #optionsdropsquarestyle ) | Controls styling of squares when dragging over them |
80+ | [ id] ( #optionsid ) | Sets the id of the chessboard component |
81+ | [ lightSquareNotationStyle] ( #optionslightsquarenotationstyle ) | Controls styling of notation on light squares |
82+ | [ lightSquareStyle] ( #optionslightsquarestyle ) | Controls styling of light squares |
83+ | [ numericNotationStyle] ( #optionsnumericnotationstyle ) | Controls styling of numeric notation (1-8) |
84+ | [ onArrowsChange] ( #optionsonarrowschange ) | Handler for when internal arrows change |
85+ | [ onMouseOutSquare] ( #optionsonmouseoutsquare ) | Handler for mouse leaving a square |
86+ | [ onMouseOverSquare] ( #optionsonmouseoversquare ) | Handler for mouse entering a square |
87+ | [ onPieceClick] ( #optionsonpiececlick ) | Handler for clicking a piece |
88+ | [ onPieceDrag] ( #optionsonpiecedrag ) | Handler for starting to drag a piece |
89+ | [ onPieceDrop] ( #optionsonpiecedrop ) | Handler for dropping a piece |
90+ | [ onSquareClick] ( #optionsonsquareclick ) | Handler for clicking a square |
91+ | [ onSquareMouseDown] ( #optionsonsquaremousedown ) | Handler for mouse button down on a square |
92+ | [ onSquareMouseUp] ( #optionsonsquaremouseup ) | Handler for mouse button up on a square |
93+ | [ onSquareRightClick] ( #optionsonsquarerightclick ) | Handler for right-clicking a square |
94+ | [ pieces] ( #optionspieces ) | Object mapping piece types to React components |
95+ | [ position] ( #optionsposition ) | Current position on the board (FEN string or position object) |
96+ | [ showAnimations] ( #optionsshowanimations ) | Controls whether piece movements are animated |
97+ | [ showNotation] ( #optionsshownotation ) | Controls whether board notation is displayed |
98+ | [ squareRenderer] ( #optionssquarerenderer ) | Controls the rendering of squares on the board |
99+ | [ squareStyle] ( #optionssquarestyle ) | Base styling applied to all squares |
100+ | [ squareStyles] ( #optionssquarestyles ) | Object mapping squares to custom styles |
99101
100102## Options
101103
@@ -380,6 +382,18 @@ Controls whether **internal** arrows are cleared when a square is clicked. If yo
380382
381383<Canvas of = { ClearArrowsOnClickStories .ClearArrowsOnClick } />
382384
385+ ### ` options.clearArrowsOnPositionChange `
386+
387+ Controls whether ** internal** arrows are cleared when the position changes. If you are passing in external arrows via the [ ` arrows ` ] ( #optionsarrows ) prop, these will not be automatically cleared when the position changes. Instead, you will need to clear them manually when updating the position and pass in a new value for the [ ` arrows ` ] ( #optionsarrows ) prop.
388+
389+ ** Default value:** ` true `
390+
391+ ** TypeScript type:** ` boolean `
392+
393+ ** Standard use case:** Disabling the ability to clear internal arrows when the position changes.
394+
395+ <Canvas of = { ClearArrowsOnPositionChangeStories .ClearArrowsOnPositionChange } />
396+
383397### ` options.darkSquareNotationStyle `
384398
385399Controls the styling of notation on dark squares. If you wish to instead hide the notation, set [ ` showNotation ` ] ( #optionsshownotation ) to ` false ` .
0 commit comments