Micro-interactions

Flip Card

A grid card that flips out of its cell — GSAP Flip carries it to viewport center while it rotates to reveal its back face, then returns on close.

Install

bun add gsap lucide-react clsx tailwind-merge

Then copy 2 files into your project:

  • components/registry/flip-card/flip-card.tsx
  • lib/utils.ts

Props

PropTypeDefaultDescription
flipDurationnumber0.5Duration of the Flip flight; rotation timing derives from it.
perspectivenumber12003D perspective depth on each card.
expandedWidthnumber400Expanded card width (clamped to the viewport).
expandedHeightnumber480Expanded card height (clamped to the viewport).
backdropBlurnumber2Backdrop scrim blur while a card is open.

What It Demonstrates

3D tilt / Flip
Rotate in 3D space (rotateX / rotateY) to add depth.
Shared element transition
An element travels and transforms from one position into another, like a thumbnail expanding into a card.
Layout animation
When an element's size or position changes, it animates to the new spot instead of snapping.
Perspective
How strong the 3D effect looks — a lower value exaggerates depth, like the viewer is closer.
Rotate
Spin an element around a point.

Related Components

Appears In