Memory Match Game

A flip-card memory matching game React component with animal-free geometric mark tiles, three difficulty levels, score and move tracking, and a win overlay. It can render inline or as a popup launched from a floating pill button.

Memory Match Game
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @reactframe/memory-match-game

Requires @reactframe in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { MemoryMatchGame } from "@/components/memory-match-game"export default function Page() {  return <MemoryMatchGame theme="night" accentColor="#fbbf24" />}
  • Adding a lightweight, self-contained memory or concentration mini-game to a landing page, blog, or product page.
  • Showing an interactive engagement widget that opens as a popup after a delay or when scrolled into view.
  • Needing a themed, animated, accessible game card that adapts to dark or light backgrounds with a custom accent color.
  • Prototyping a card-flip matching interaction with Motion animations and Tailwind styling.

Examples

Inline game card in light mode

Renders the game directly in the page flow using the light palette and the 'gold' theme.

inline-game-card-in-light-mode.tsx
import { MemoryMatchGame } from "@/components/memory-match-game"export default function InlineDemo() {  return (    <section className="mx-auto max-w-xl p-6">      <MemoryMatchGame theme="gold" lightMode accentColor="#f97316" />    </section>  )}

Popup launched after a delay

Shows a floating 'Play Memory' pill in the bottom-left corner that automatically opens the game modal after 6 seconds.

popup-launched-after-a-delay.tsx
import { MemoryMatchGame } from "@/components/memory-match-game"export default function DelayedPopup() {  return (    <MemoryMatchGame      asPopup      trigger="delay"      delaySeconds={6}      widgetPosition="bottom-left"      theme="neon"      accentColor="#818cf8"    />  )}

Popup opened when scrolled into view with custom icon

Opens the modal once at least 40% of the component enters the viewport, using a custom image in the floating button.

popup-opened-when-scrolled-into-view-with-custom-icon.tsx
import { MemoryMatchGame } from "@/components/memory-match-game"export default function ScrollPopup() {  return (    <MemoryMatchGame      asPopup      trigger="scroll"      theme="tide"      accentColor="#2dd4bf"      widgetIcon="/icons/memory.png"      className="my-12"    />  )}

API reference

PropTypeDefaultDescription
theme"night" | "neon" | "gold" | "tide""night"Selects the color palette and the title, subtitle, and button text preset for the game card.
lightModebooleanfalseSwitches text, surfaces, borders, and the card background to the light palette.
accentColorstring"#ffffff"CSS color used for the active difficulty pill, the primary action button, and the win dialog button. An empty string falls back to #ffffff.
asPopupbooleanfalseWhen true, renders a floating trigger button and shows the game inside a modal dialog instead of inline.
trigger"manual" | "delay" | "scroll""manual"In popup mode, controls how the modal opens: manually via the trigger button, after delaySeconds, or when the component intersects the viewport at 40% visibility.
delaySecondsnumber4Seconds to wait before automatically opening the popup when trigger is "delay".
widgetPosition"bottom-right" | "bottom-left""bottom-right"Alignment of the floating trigger button in popup mode.
widgetIconstring—Optional image URL that replaces the default four-square icon inside the popup trigger button.
classNamestring—Additional Tailwind classes merged onto the outer wrapper div.
styleReact.CSSProperties—Inline styles applied to the outer wrapper div.

Accessibility

  • The game board has role="application" with an aria-label such as 'Memory memory game' and is focusable via tabIndex=0.
  • Each tile is a native button; hidden tiles are labeled 'Hidden card' and revealed tiles are labeled 'Mark' followed by the symbol, with aria-pressed reflecting flipped state.
  • Difficulty selection uses a group with aria-label 'Difficulty' and buttons exposing aria-pressed.
  • The score, moves, and level stats sit inside an aria-live="polite" region so updates are announced.
  • The win overlay is a role="dialog" labelled by its heading, and the popup uses aria-modal="true" with Escape to close and focus moved into the game on open and back to the trigger on close.
  • The popup close button has aria-label 'Close game', and the floating trigger uses the theme's trigger text as its aria-label.
  • Animations use Motion; users with reduced-motion preferences should be considered, since the flip and pulsing text effects are not disabled automatically by the component.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Memory Match Game" component (reactframe/memory-match-game) from its shadcn registry.1. Install it with: npx shadcn@latest add @reactframe/memory-match-game2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: theme, lightMode, accentColor, asPopup, trigger, delaySeconds, widgetPosition, widgetIcon, className, style.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { MemoryMatchGame } from "@/components/memory-match-game"export default function Page() {  return <MemoryMatchGame theme="night" accentColor="#fbbf24" />}```

Files & dependencies

  • registry/new-york/memory-match-game/memory-match-game.tsx
dependenciesmotionclsxtailwind-merge

Looks similar, elsewhere