Bridge Training
Bridge ReactHand

HandsEditor

Value/onChange-driven hands editor with Board, PlayerSelector, and SelectedPlayerAlert.

Import from @workspace/bridge-react/hand/editors/hands-editor.

Overview

HandsEditor is a self-contained hands editor that composes Board, PlayerSelector, and SelectedPlayerAlert. It follows the value/onChange pattern with no react-hook-form dependency.

import { HandsEditor } from '@workspace/bridge-react/hand/editors/hands-editor';

<HandsEditor
  hands={hands}
  selectedPlayer={selectedPlayer}
  onCardsChange={(player, suit, ranks) => updateHand(player, suit, ranks)}
  onSelectedPlayerChange={setSelectedPlayer}
/>

Composition

The editor is composed from:

Internal ComponentRole
Board4-hand board layout with editable/read-only hands
PlayerSelectorCompass-style player position selector (buttons variant)
SelectedPlayerAlertAlert showing which player is currently being edited

Read-Only Mode

Pass readOnly to hide the player selector and disable hand editing:

<HandsEditor
  hands={hands}
  selectedPlayer="S"
  readOnly
/>

Props

Prop

Type

Notes

  • Wrapped with withBridgeContext — can be used outside a BridgeProvider
  • Confirmation logic (e.g. warning when editing played suits) is the responsibility of the consuming wrapper

On this page