0.2.3 • Published 3 years ago

@holdem-poker-tools/hand-matrix v0.2.3

Weekly downloads
22
License
MIT
Repository
github
Last release
3 years ago

Hold'em Poker Tools React hand matrix is a React component to make displaying poker ranges simple!

Install

Install via NPM (or Yarn):

npm i --save @holdem-poker-tools/hand-matrix

Usage

const range = ['AA', 'KK', 'QQ', 'AKs', 'AQs'];

<HandMatrix
  colorize={false}
  comboStyle={(combo) => ({
    background: range.indexOf(combo) !== -1 ? "lightgreen" : "lightgrey"
  })}
  comboSubtext={(combo) => range.indexOf(combo) !== -1 ? "100%" : "0%"}
  onSelect={combo => console.log(`selected ${combo}`)}
  onPointerDown={combo => console.log(`pointerDown on ${combo}`)}
  onPointerUp={combo => console.log(`pointerUp on ${combo}`)}
  onPointerEnter={combo => console.log(`pointerEnter on ${combo}`)}
  onPointerMove={combo => console.log(`pointerMove on ${combo}`)}
/>

For an advanced usage example, see the Hold'em Tools Range Assistant web app and associated GitHub repository.

API

PropTypeDefaultRequiredDescription
colorizeBooleantrue:x:Whether to apply default colors to the hand matrix to distinguish pairs vs offsuit vs suited hands. The result of the comboStyle function will override these default colors.
comboStyleFunction:x:Function which receives the combo (e.g. AKo) and must return an object containing the styles to apply to the matrix tile for that combo e.g. {background: "#FFFFFF"}. Useful for displaying ranges.
showTextBooleantrue:x:Whether to show the text in the combo cells
comboSubtextFunction:x:Function which receives the combo (e.g. AKo) and must return the text or React components to display beneath the combo text. Default is for no text to be displayed. Useful for displaying information such as combo equity
onSelectFunction:x:Click event handler for a combo tile. Will be called with combo e.g. AKo
onPointerDownFunction:x:Pointer down event handler for a combo tile. Will be called with combo e.g. AKo
onPointerEnterFunction:x:Pointer enter event handler for a combo tile. Will be called with combo e.g. AKo
onPointerMoveFunction:x:Pointer move event handler for a combo tile. Will be called with combo e.g. AKo
onPointerUpFunction:x:Pointer up event handler for a combo tile. Will be called with combo e.g. AKo

Support

All Hold'em Poker Tools projects are open source and free to use or extend to your heart's extent. If you'd like to say thanks, feel free to show your support on Buy Me a Coffee:

License

MIT

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

4 years ago