Flip Card

A card that turns over in 3D to show its back, on hover or click.

no dependenciesMIT · free
Hover meFront
The other sideAnything can live back here: details, a price, a CTA.
Click meFlip
Click againBack

Installation

npx shadcn@latest add https://ombakui.com/r/flip-card.json

Usage

import { FlipCard } from "@/components/flip-card";

<FlipCard className="h-72 w-56" front={<Front />} back={<Back />} />
<FlipCard trigger="click" axis="x" front={<Front />} back={<Back />} />

Props

PropTypeDefaultDescription
front*ReactNode–Front face.
back*ReactNode–Back face.
trigger"hover" | "click""hover""hover" flips on hover (and focus); "click" flips on click, tap or Enter.
axis"x" | "y""y"Flip around the vertical (y) or horizontal (x) axis.
durationnumber700Milliseconds for the flip.
classNamestring–Size the card here, e.g. "h-72 w-56".