react-native-chess-kit 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,8 @@ import type { SharedValue, BaseAnimationBuilder } from 'react-native-reanimated'
3
3
  export type ChessColor = 'white' | 'black';
4
4
  /** How the user interacts with pieces */
5
5
  export type MoveMethod = 'drag' | 'click' | 'both';
6
+ /** Where to render file/rank coordinate labels */
7
+ export type CoordinatePosition = 'inside' | 'outside' | 'none';
6
8
  /** Promotion piece choice */
7
9
  export type PromotionPiece = 'q' | 'r' | 'b' | 'n';
8
10
  /** Haptic feedback event types -- consumer wires to their preferred haptics library */
@@ -147,9 +149,18 @@ export type BoardProps = {
147
149
  premovesEnabled?: boolean;
148
150
  /** Board square colors. Default: green theme */
149
151
  colors?: BoardColors;
150
- /** Whether to show file labels (a-h). Default: true */
152
+ /**
153
+ * Where to render file/rank coordinate labels.
154
+ * - 'inside' — overlaid on the edge squares (default)
155
+ * - 'outside' — in a gutter around the board (board shrinks slightly)
156
+ * - 'none' — hidden
157
+ *
158
+ * @default 'inside'
159
+ */
160
+ coordinatePosition?: CoordinatePosition;
161
+ /** @deprecated Use coordinatePosition instead. Kept for backwards compat. */
151
162
  withLetters?: boolean;
152
- /** Whether to show rank numbers (1-8). Default: true */
163
+ /** @deprecated Use coordinatePosition instead. Kept for backwards compat. */
153
164
  withNumbers?: boolean;
154
165
  /** Custom piece renderer. Receives piece code ('wp', 'bk', etc.) and pixel size. */
155
166
  renderPiece?: (pieceCode: string, size: number) => React.ReactElement;
@@ -233,7 +244,16 @@ export type StaticBoardProps = {
233
244
  boardSize?: number;
234
245
  /** Board square colors. Default: green theme */
235
246
  colors?: BoardColors;
236
- /** Whether to show coordinate labels. Default: false */
247
+ /**
248
+ * Where to render file/rank coordinate labels.
249
+ * - 'inside' — overlaid on the edge squares
250
+ * - 'outside' — in a gutter around the board (board shrinks slightly)
251
+ * - 'none' — hidden (default)
252
+ *
253
+ * @default 'none'
254
+ */
255
+ coordinatePosition?: CoordinatePosition;
256
+ /** @deprecated Use coordinatePosition instead */
237
257
  withCoordinates?: boolean;
238
258
  /** Custom piece renderer */
239
259
  renderPiece?: (pieceCode: string, size: number) => React.ReactElement;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAMjF,qCAAqC;AACrC,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3C,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnD,6BAA6B;AAC7B,MAAM,MAAM,cAAc,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEnD,uFAAuF;AACvF,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAMjE,uDAAuD;AACvD,MAAM,MAAM,SAAS,GACjB,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GACvC,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG;IACvB,gFAAgF;IAChF,EAAE,EAAE,MAAM,CAAC;IACX,4FAA4F;IAC5F,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB;IACjB,KAAK,EAAE,GAAG,GAAG,GAAG,CAAC;CAClB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,GAAG,GAAG,GAAG,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CAAC;IAC/C,wBAAwB;IACxB,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAC7B,aAAa;IACb,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,kBAAkB;IAClB,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;CAChC,CAAC;AAMF,MAAM,MAAM,YAAY,GAAG;IACzB,uEAAuE;IACvE,YAAY,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,kDAAkD;IAClD,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,iDAAiD;IACjD,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC,6DAA6D;IAC7D,aAAa,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1C,2EAA2E;IAC3E,gBAAgB,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC9C,CAAC;AAMF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-chess-kit",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "High-performance chess board for React Native. Single gesture handler, ~40 components, 0 re-renders during drag. Built on Reanimated + Gesture Handler.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { View, Text } from 'react-native';
3
3
 
4
- import type { ChessColor } from './types';
4
+ import type { ChessColor, CoordinatePosition } from './types';
5
5
 
6
6
  type BoardCoordinatesProps = {
7
7
  boardSize: number;
@@ -10,6 +10,10 @@ type BoardCoordinatesProps = {
10
10
  darkColor: string;
11
11
  withLetters: boolean;
12
12
  withNumbers: boolean;
13
+ /** 'inside' overlays on edge squares, 'outside' renders in a gutter area. */
14
+ position?: 'inside' | 'outside';
15
+ /** Gutter width in pixels (only used when position='outside'). */
16
+ gutterWidth?: number;
13
17
  };
14
18
 
15
19
  const FILES_WHITE = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
@@ -18,11 +22,13 @@ const RANKS_WHITE = ['8', '7', '6', '5', '4', '3', '2', '1'];
18
22
  const RANKS_BLACK = ['1', '2', '3', '4', '5', '6', '7', '8'];
19
23
 
20
24
  /**
21
- * File letters (a-h) and rank numbers (1-8) drawn on the board edges.
25
+ * File letters (a-h) and rank numbers (1-8) drawn on or around the board.
22
26
  *
23
- * Rendered as absolute-positioned Text components inside each corner square.
24
- * File letters appear on the bottom rank, rank numbers on the left file.
25
- * Colors alternate to contrast with the square behind them.
27
+ * Two modes:
28
+ * - **inside** (default): absolute-positioned inside each edge square, colors
29
+ * alternate to contrast with the square behind them.
30
+ * - **outside**: rendered in a gutter area around the board. Rank numbers to
31
+ * the left, file letters along the bottom. Uses the dark square color.
26
32
  */
27
33
  export const BoardCoordinates = React.memo(function BoardCoordinates({
28
34
  boardSize,
@@ -31,15 +37,105 @@ export const BoardCoordinates = React.memo(function BoardCoordinates({
31
37
  darkColor,
32
38
  withLetters,
33
39
  withNumbers,
40
+ position = 'inside',
41
+ gutterWidth = 0,
34
42
  }: BoardCoordinatesProps) {
35
43
  if (!withLetters && !withNumbers) return null;
36
44
 
37
45
  const squareSize = boardSize / 8;
38
- const fontSize = squareSize * 0.22;
39
- const padding = squareSize * 0.06;
40
46
  const files = orientation === 'white' ? FILES_WHITE : FILES_BLACK;
41
47
  const ranks = orientation === 'white' ? RANKS_WHITE : RANKS_BLACK;
42
48
 
49
+ // ── Outside mode: labels in gutter area around the board ──
50
+ if (position === 'outside') {
51
+ const fontSize = gutterWidth * 0.65;
52
+ const textColor = darkColor;
53
+
54
+ return (
55
+ <>
56
+ {/* Rank numbers — left gutter, vertically centered on each row */}
57
+ {withNumbers && (
58
+ <View
59
+ style={{
60
+ position: 'absolute',
61
+ left: 0,
62
+ top: 0,
63
+ width: gutterWidth,
64
+ height: boardSize,
65
+ }}
66
+ pointerEvents="none"
67
+ >
68
+ {ranks.map((rank, row) => (
69
+ <View
70
+ key={`r-${rank}`}
71
+ style={{
72
+ position: 'absolute',
73
+ top: row * squareSize,
74
+ width: gutterWidth,
75
+ height: squareSize,
76
+ alignItems: 'center',
77
+ justifyContent: 'center',
78
+ }}
79
+ >
80
+ <Text
81
+ style={{
82
+ fontSize,
83
+ fontWeight: '600',
84
+ color: textColor,
85
+ }}
86
+ >
87
+ {rank}
88
+ </Text>
89
+ </View>
90
+ ))}
91
+ </View>
92
+ )}
93
+
94
+ {/* File letters — bottom gutter, horizontally centered on each column */}
95
+ {withLetters && (
96
+ <View
97
+ style={{
98
+ position: 'absolute',
99
+ left: withNumbers ? gutterWidth : 0,
100
+ bottom: 0,
101
+ width: boardSize,
102
+ height: gutterWidth,
103
+ }}
104
+ pointerEvents="none"
105
+ >
106
+ {files.map((file, col) => (
107
+ <View
108
+ key={`f-${file}`}
109
+ style={{
110
+ position: 'absolute',
111
+ left: col * squareSize,
112
+ width: squareSize,
113
+ height: gutterWidth,
114
+ alignItems: 'center',
115
+ justifyContent: 'center',
116
+ }}
117
+ >
118
+ <Text
119
+ style={{
120
+ fontSize,
121
+ fontWeight: '600',
122
+ color: textColor,
123
+ }}
124
+ >
125
+ {file}
126
+ </Text>
127
+ </View>
128
+ ))}
129
+ </View>
130
+ )}
131
+ </>
132
+ );
133
+ }
134
+
135
+ // ── Inside mode (default): absolute-positioned inside edge squares ──
136
+ const fontSize = squareSize * 0.22;
137
+ const padding = squareSize * 0.06;
138
+
43
139
  return (
44
140
  <View
45
141
  style={{ position: 'absolute', width: boardSize, height: boardSize }}
@@ -48,7 +144,6 @@ export const BoardCoordinates = React.memo(function BoardCoordinates({
48
144
  {/* Rank numbers along left edge (inside each row's first square) */}
49
145
  {withNumbers &&
50
146
  ranks.map((rank, row) => {
51
- // First column square: row 0 col 0 = light if (0+0)%2===0
52
147
  const isLight = row % 2 === 0;
53
148
  const textColor = isLight ? darkColor : lightColor;
54
149
 
@@ -72,7 +167,6 @@ export const BoardCoordinates = React.memo(function BoardCoordinates({
72
167
  {/* File letters along bottom edge (inside each column's last square) */}
73
168
  {withLetters &&
74
169
  files.map((file, col) => {
75
- // Last row (7), column col: light if (7+col)%2===0
76
170
  const isLight = (7 + col) % 2 === 0;
77
171
  const textColor = isLight ? darkColor : lightColor;
78
172
 
package/src/board.tsx CHANGED
@@ -33,6 +33,7 @@ import {
33
33
  DEFAULT_PREMOVE_COLOR,
34
34
  DEFAULT_DRAG_TARGET_COLOR,
35
35
  CAPTURE_FADE_DURATION,
36
+ COORDINATE_GUTTER_SCALE,
36
37
  } from './constants';
37
38
  import { DefaultPieceSet } from './pieces';
38
39
  import { useBoardPieces } from './use-board-pieces';
@@ -131,8 +132,9 @@ export const Board = forwardRef<BoardRef, BoardProps>(function Board(
131
132
 
132
133
  // Appearance
133
134
  colors,
134
- withLetters = true,
135
- withNumbers = true,
135
+ coordinatePosition: coordinatePositionProp,
136
+ withLetters: withLettersProp,
137
+ withNumbers: withNumbersProp,
136
138
  renderPiece,
137
139
  pieceSet,
138
140
 
@@ -179,10 +181,20 @@ export const Board = forwardRef<BoardRef, BoardProps>(function Board(
179
181
  setMeasuredSize(Math.min(width, height));
180
182
  }, []);
181
183
 
182
- const boardSize = boardSizeProp ?? measuredSize;
183
- const squareSize = boardSize / 8;
184
+ const outerSize = boardSizeProp ?? measuredSize;
184
185
  const boardColors = colors ?? DEFAULT_BOARD_COLORS;
185
186
 
187
+ // Resolve coordinate position: new prop takes precedence over legacy booleans
188
+ const coordinatePosition = coordinatePositionProp
189
+ ?? (withLettersProp === false && withNumbersProp === false ? 'none' : 'inside');
190
+ const isOutside = coordinatePosition === 'outside';
191
+ const isCoordVisible = coordinatePosition !== 'none';
192
+
193
+ // When outside: reserve gutter space; inner board = outer minus gutters
194
+ const gutterWidth = isOutside ? Math.round((outerSize / 8) * COORDINATE_GUTTER_SCALE) : 0;
195
+ const boardSize = isOutside ? outerSize - gutterWidth : outerSize;
196
+ const squareSize = boardSize / 8;
197
+
186
198
  // Resolve piece exit animation: null = disabled, undefined = default FadeOut
187
199
  const resolvedPieceExitAnimation =
188
200
  pieceExitAnimation === null
@@ -512,17 +524,20 @@ export const Board = forwardRef<BoardRef, BoardProps>(function Board(
512
524
  }));
513
525
 
514
526
  // If no size yet (auto-sizing), render invisible container for measurement
515
- if (boardSize === 0) {
527
+ if (outerSize === 0) {
516
528
  return (
517
529
  <View style={{ flex: 1, aspectRatio: 1 }} onLayout={handleLayout} />
518
530
  );
519
531
  }
520
532
 
521
- return (
533
+ // Inner board with all interactive layers
534
+ const boardContent = (
522
535
  <GestureDetector gesture={gesture}>
523
536
  <View
524
- style={{ width: boardSize, height: boardSize }}
525
- onLayout={boardSizeProp ? undefined : handleLayout}
537
+ style={isOutside
538
+ ? { width: boardSize, height: boardSize, position: 'absolute', top: 0, right: 0 }
539
+ : { width: boardSize, height: boardSize }}
540
+ onLayout={!isOutside && !boardSizeProp ? handleLayout : undefined}
526
541
  accessibilityLabel="Chess board"
527
542
  accessibilityRole="adjustable"
528
543
  >
@@ -533,15 +548,18 @@ export const Board = forwardRef<BoardRef, BoardProps>(function Board(
533
548
  darkColor={boardColors.dark}
534
549
  />
535
550
 
536
- {/* Layer 2: Coordinate labels (a-h, 1-8) */}
537
- <BoardCoordinates
538
- boardSize={boardSize}
539
- orientation={orientation}
540
- lightColor={boardColors.light}
541
- darkColor={boardColors.dark}
542
- withLetters={withLetters}
543
- withNumbers={withNumbers}
544
- />
551
+ {/* Layer 2: Inside coordinate labels (when position='inside') */}
552
+ {isCoordVisible && !isOutside && (
553
+ <BoardCoordinates
554
+ boardSize={boardSize}
555
+ orientation={orientation}
556
+ lightColor={boardColors.light}
557
+ darkColor={boardColors.dark}
558
+ withLetters
559
+ withNumbers
560
+ position="inside"
561
+ />
562
+ )}
545
563
 
546
564
  {/* Layer 3: Square highlights (last move, check, selected, premove, custom, imperative) */}
547
565
  <BoardHighlights
@@ -638,4 +656,30 @@ export const Board = forwardRef<BoardRef, BoardProps>(function Board(
638
656
  </View>
639
657
  </GestureDetector>
640
658
  );
659
+
660
+ // Outside coordinates: wrap board in outer container with gutter
661
+ if (isOutside) {
662
+ return (
663
+ <View
664
+ style={{ width: outerSize, height: boardSize + gutterWidth }}
665
+ onLayout={boardSizeProp ? undefined : handleLayout}
666
+ >
667
+ {boardContent}
668
+
669
+ {/* Outside coordinate labels in the gutter area */}
670
+ <BoardCoordinates
671
+ boardSize={boardSize}
672
+ orientation={orientation}
673
+ lightColor={boardColors.light}
674
+ darkColor={boardColors.dark}
675
+ withLetters
676
+ withNumbers
677
+ position="outside"
678
+ gutterWidth={gutterWidth}
679
+ />
680
+ </View>
681
+ );
682
+ }
683
+
684
+ return boardContent;
641
685
  });
package/src/constants.ts CHANGED
@@ -75,6 +75,9 @@ export const ANNOTATION_SCALE = 0.35;
75
75
  /** Coordinate font size as fraction of square size */
76
76
  export const COORDINATE_FONT_SCALE = 0.22;
77
77
 
78
+ /** Outside-coordinate gutter width as fraction of square size */
79
+ export const COORDINATE_GUTTER_SCALE = 0.45;
80
+
78
81
  /** Drag ghost scale factor (1.1x larger than normal piece) */
79
82
  export const DRAG_GHOST_SCALE = 1.1;
80
83
 
package/src/index.ts CHANGED
@@ -65,6 +65,7 @@ export type {
65
65
  BoardProps,
66
66
  BoardColors,
67
67
  StaticBoardProps,
68
+ CoordinatePosition,
68
69
 
69
70
  // Piece data (useful for custom piece renderers)
70
71
  BoardPiece,
@@ -2,7 +2,7 @@ import React, { useState, useCallback, useMemo } from 'react';
2
2
  import { View, type LayoutChangeEvent } from 'react-native';
3
3
 
4
4
  import type { StaticBoardProps, ChessColor, PieceCode } from './types';
5
- import { DEFAULT_BOARD_COLORS, DEFAULT_LAST_MOVE_COLOR } from './constants';
5
+ import { DEFAULT_BOARD_COLORS, DEFAULT_LAST_MOVE_COLOR, COORDINATE_GUTTER_SCALE } from './constants';
6
6
  import { DefaultPieceSet } from './pieces';
7
7
  import { useBoardPieces, squareToXY } from './use-board-pieces';
8
8
  import { BoardBackground } from './board-background';
@@ -24,7 +24,8 @@ export const StaticBoard = React.memo(function StaticBoard({
24
24
  orientation = 'white',
25
25
  boardSize: boardSizeProp,
26
26
  colors,
27
- withCoordinates = false,
27
+ coordinatePosition: coordinatePositionProp,
28
+ withCoordinates,
28
29
  renderPiece,
29
30
  pieceSet,
30
31
  lastMove,
@@ -39,10 +40,19 @@ export const StaticBoard = React.memo(function StaticBoard({
39
40
  setMeasuredSize(Math.min(width, height));
40
41
  }, []);
41
42
 
42
- const boardSize = boardSizeProp ?? measuredSize;
43
- const squareSize = boardSize / 8;
43
+ const outerSize = boardSizeProp ?? measuredSize;
44
44
  const boardColors = colors ?? DEFAULT_BOARD_COLORS;
45
45
 
46
+ // Resolve coordinate position: new prop > legacy boolean > 'none'
47
+ const coordinatePosition = coordinatePositionProp
48
+ ?? (withCoordinates ? 'inside' : 'none');
49
+ const isOutside = coordinatePosition === 'outside';
50
+ const isCoordVisible = coordinatePosition !== 'none';
51
+
52
+ const gutterWidth = isOutside ? Math.round((outerSize / 8) * COORDINATE_GUTTER_SCALE) : 0;
53
+ const boardSize = isOutside ? outerSize - gutterWidth : outerSize;
54
+ const squareSize = boardSize / 8;
55
+
46
56
  // --- Piece data from FEN ---
47
57
  const pieces = useBoardPieces(fen);
48
58
 
@@ -59,16 +69,18 @@ export const StaticBoard = React.memo(function StaticBoard({
59
69
  }, [renderPiece, pieceSet]);
60
70
 
61
71
  // If no size yet (auto-sizing), render invisible container for measurement
62
- if (boardSize === 0) {
72
+ if (outerSize === 0) {
63
73
  return (
64
74
  <View style={{ flex: 1, aspectRatio: 1 }} onLayout={handleLayout} />
65
75
  );
66
76
  }
67
77
 
68
- return (
78
+ const boardContent = (
69
79
  <View
70
- style={{ width: boardSize, height: boardSize }}
71
- onLayout={boardSizeProp ? undefined : handleLayout}
80
+ style={isOutside
81
+ ? { width: boardSize, height: boardSize, position: 'absolute', top: 0, right: 0 }
82
+ : { width: boardSize, height: boardSize }}
83
+ onLayout={!isOutside && !boardSizeProp ? handleLayout : undefined}
72
84
  accessibilityLabel="Chess board"
73
85
  accessibilityRole="image"
74
86
  >
@@ -79,8 +91,8 @@ export const StaticBoard = React.memo(function StaticBoard({
79
91
  darkColor={boardColors.dark}
80
92
  />
81
93
 
82
- {/* Layer 2: Coordinates */}
83
- {withCoordinates && (
94
+ {/* Layer 2: Inside coordinates */}
95
+ {isCoordVisible && !isOutside && (
84
96
  <BoardCoordinates
85
97
  boardSize={boardSize}
86
98
  orientation={orientation}
@@ -88,6 +100,7 @@ export const StaticBoard = React.memo(function StaticBoard({
88
100
  darkColor={boardColors.dark}
89
101
  withLetters
90
102
  withNumbers
103
+ position="inside"
91
104
  />
92
105
  )}
93
106
 
@@ -147,4 +160,28 @@ export const StaticBoard = React.memo(function StaticBoard({
147
160
  )}
148
161
  </View>
149
162
  );
163
+
164
+ if (isOutside) {
165
+ return (
166
+ <View
167
+ style={{ width: outerSize, height: boardSize + gutterWidth }}
168
+ onLayout={boardSizeProp ? undefined : handleLayout}
169
+ >
170
+ {boardContent}
171
+
172
+ <BoardCoordinates
173
+ boardSize={boardSize}
174
+ orientation={orientation}
175
+ lightColor={boardColors.light}
176
+ darkColor={boardColors.dark}
177
+ withLetters
178
+ withNumbers
179
+ position="outside"
180
+ gutterWidth={gutterWidth}
181
+ />
182
+ </View>
183
+ );
184
+ }
185
+
186
+ return boardContent;
150
187
  });
package/src/types.ts CHANGED
@@ -10,6 +10,9 @@ export type ChessColor = 'white' | 'black';
10
10
  /** How the user interacts with pieces */
11
11
  export type MoveMethod = 'drag' | 'click' | 'both';
12
12
 
13
+ /** Where to render file/rank coordinate labels */
14
+ export type CoordinatePosition = 'inside' | 'outside' | 'none';
15
+
13
16
  /** Promotion piece choice */
14
17
  export type PromotionPiece = 'q' | 'r' | 'b' | 'n';
15
18
 
@@ -208,9 +211,18 @@ export type BoardProps = {
208
211
 
209
212
  /** Board square colors. Default: green theme */
210
213
  colors?: BoardColors;
211
- /** Whether to show file labels (a-h). Default: true */
214
+ /**
215
+ * Where to render file/rank coordinate labels.
216
+ * - 'inside' — overlaid on the edge squares (default)
217
+ * - 'outside' — in a gutter around the board (board shrinks slightly)
218
+ * - 'none' — hidden
219
+ *
220
+ * @default 'inside'
221
+ */
222
+ coordinatePosition?: CoordinatePosition;
223
+ /** @deprecated Use coordinatePosition instead. Kept for backwards compat. */
212
224
  withLetters?: boolean;
213
- /** Whether to show rank numbers (1-8). Default: true */
225
+ /** @deprecated Use coordinatePosition instead. Kept for backwards compat. */
214
226
  withNumbers?: boolean;
215
227
  /** Custom piece renderer. Receives piece code ('wp', 'bk', etc.) and pixel size. */
216
228
  renderPiece?: (pieceCode: string, size: number) => React.ReactElement;
@@ -308,7 +320,16 @@ export type StaticBoardProps = {
308
320
  boardSize?: number;
309
321
  /** Board square colors. Default: green theme */
310
322
  colors?: BoardColors;
311
- /** Whether to show coordinate labels. Default: false */
323
+ /**
324
+ * Where to render file/rank coordinate labels.
325
+ * - 'inside' — overlaid on the edge squares
326
+ * - 'outside' — in a gutter around the board (board shrinks slightly)
327
+ * - 'none' — hidden (default)
328
+ *
329
+ * @default 'none'
330
+ */
331
+ coordinatePosition?: CoordinatePosition;
332
+ /** @deprecated Use coordinatePosition instead */
312
333
  withCoordinates?: boolean;
313
334
  /** Custom piece renderer */
314
335
  renderPiece?: (pieceCode: string, size: number) => React.ReactElement;