Put the two faces in the coin, then add the result and a trigger.
who-pays.tsx
CoinFlip
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| value | "heads""tails" | — | The face that shows at rest. Controlled: the coin lands on its own pick, then asks for it. |
| default | "heads""tails" | "heads" | |
| on | — | Called when the coin comes to rest, with the face that shows. | |
| on | — | Called when a toss starts: a press on the coin or the trigger that the coin takes. | |
| disabled | boolean | false | Stops new tosses. A toss in the air still lands. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
CoinFlipCoin
<button>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| style | CSSProperties | — | |
From Base UIButtonBase UI docs | |||
| focusable | boolean | false | Whether the button should be focusable when disabled. |
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| native | boolean | true | Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (for example, <div>). |
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. |
CoinFlipHeads
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
CoinFlipTails
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
CoinFlipTrigger
<button>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| glass | "clear""dark""light" | — | |||||
| rounded | "default""full" | — | |||||
| size | "default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs" | — | |||||
| variant | "dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary" | — | |||||
| class | string | — | |||||
| busy | boolean | — | The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading. | ||||
| spinner | "center""start" | — | center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label. | ||||
From Base UIButtonBase UI docs | |||||||
| focusable | boolean | false | Whether the button should be focusable when disabled. | ||||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |||||
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |||||
| |||||||
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. | ||||
CoinFlipValue
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| value | "heads""tails" | — | The face this part waits for. |
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
| EnterorSpace | Tosses the coin when the coin or CoinFlipTrigger has focus. A press while the coin is in the air does nothing. |
|---|
Built with
Installs with Coin Flip
- Components
- Button









