Back to components
ComponentWidgetFree

Coin Flip Game React component

A real 3D CSS coin, click or tap to flip with a physical spin animation, a yes/no question field, flip history dots, and a heads/tails ratio readout.

About the Coin Flip Game component

Coin Flip Game is a heads-or-tails coin toss for yes-or-no decisions. People type a question, then tap the coin or the button, and a 3D metal coin spins for about a second and lands on Heads (yes) or Tails (no). It keeps the last 12 results as dots with the heads and tails percentages above them.

theme picks one of four looks (night, neon, gold, tide), each with its own coin metal, title and subtitle, and lightMode switches to a light background. headsImage and tailsImage replace the letters on the two faces with your own images, size sets the coin size between 120 and 200px, and accentColor colors the main button. The result is read out to screen readers through a polite live region.

When to use it

Use it as a small playful tool on a blog, a portfolio or a team page, or as an engagement widget on a landing page that can be opened from a button.

To hand out a reward or a discount code instead of a yes or no, use Spin to Win Wheel or Dice Roll Discount Popup.

Installation

Add the Coin Flip Game component to your project with the shadcn CLI. It lands in components/coin-flip-game.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/coin-flip-game

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install clsx tailwind-merge

More Widget components

Tic Tac Toe Game
Free
QR Code Widget
Free
2048 Game
Free
Google Maps Embed
Free
Snake Game
Free
SEO-ready
Business Hours
Free