Bridge Training
Bridge ReactBidding

AuctionEditor

Value/onChange-driven auction editor with grid display and bid pad.

Import from @workspace/bridge-react/bidding/editors/auction-editor.

Overview

AuctionEditor is a self-contained auction editor that composes AuctionGrid, BidPad, BidCommentsList, and AuctionDeclarerAlert. It follows the value/onChange pattern with no react-hook-form dependency.

import { AuctionEditor } from '@workspace/bridge-react/bidding/editors/auction-editor';
import type { AuctionValue } from '@workspace/bridge-react/bidding/editors/auction-editor';

const [auction, setAuction] = useState<AuctionValue>({
  dealer: 'N',
  sequence: [],
  lastBid: null,
});

<AuctionEditor
  auction={auction}
  vulnerability="NS"
  onAuctionChange={setAuction}
  onComment={(bidIndex, comment) => console.log('Comment', bidIndex, comment)}
  onAlert={(bidIndex, isAlerted) => console.log('Alert', bidIndex, isAlerted)}
/>

AuctionValue

The auction state is represented as a value object:

type AuctionValue = {
  dealer: Player;
  sequence: BidInfo[];
  lastBid: Bid | null;
};

Composition

The editor is composed from:

Internal ComponentRole
AuctionGridGrid display of bids organized by player columns
BidPadInteractive bid selection pad
BidCommentsListList of bid comments below the grid
AuctionDeclarerAlertAlert for declarer position validation

Features

  • Bid validation — only valid bids are selectable in the BidPad
  • Auto-fix declarer — can rotate dealer to ensure South is always declarer
  • Comment/alert handling — per-bid comments and alert toggles
  • Undo — remove the last bid from the sequence

Read-Only Mode

Pass readOnly to hide the BidPad and disable all interactions:

<AuctionEditor
  auction={auction}
  readOnly
/>

Props

Prop

Type

Notes

  • Wrapped with withBridgeContext — can be used outside a BridgeProvider
  • Uses createBridgeEngineFromVariant() internally for bid validation and declarer computation

On this page