Skip to content
VenusUI
Get started

Flip Card

A two-sided card that turns over in 3D, by button or on hover.

Preview

Installation

npx shadcn@latest add @venusui/flip-card

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/flip-card.tsx

Usage

The code behind the preview above.

flip-card-demo.tsx

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

export default function FlipCardDemo() {
  return (
    <FlipCard
      flipOnHover
      flipLabel="Show plan details"
      front={
        <div className="flex h-full flex-col justify-between">
          <p className="font-mono text-xs tracking-widest text-muted-foreground uppercase">Team plan</p>
          <p className="text-4xl font-semibold tracking-tight">$79<span className="text-base font-normal text-muted-foreground">/month</span></p>
          <p className="text-sm text-muted-foreground">Hover, or press the button to flip.</p>
        </div>
      }
      back={
        <ul className="space-y-2 text-sm">
          <li>Up to 10 members</li>
          <li>Roles and permissions</li>
          <li>Priority support</li>
          <li>Audit log</li>
        </ul>
      }
    />
  )
}

API reference

PropTypeDefaultDescription
frontReactNode—Front face content. Required.
backReactNode—Back face content. Required.
flipLabelstring"Flip card"Accessible name for the flip button.
flipOnHoverbooleanfalseAlso flip while a mouse is over the card.
classNamestring—Classes for the outer element, e.g. a different height.

Only the props above.

Requirements

  • lucide-react for the flip icon, React 19 and Tailwind CSS v4.

Customization

  • The card is h-64 by default. Pass className="h-80" for taller content; both faces fill it.
  • Use a descriptive flipLabel such as "Show plan details".

Accessibility

  • Flipping is done with a real button (aria-pressed), so it works with keyboard, touch and screen readers; hover is an extra.
  • The hidden face is inert and aria-hidden, so its content can’t be focused or read by mistake.
  • With reduced motion the faces swap instantly.

Troubleshooting

Both faces show at once.
The effect needs backface-visibility: hidden and transform-style: preserve-3d; don’t remove those classes.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A card that tilts in 3D toward the pointer with spring physics.

Loading preview

Stacked cards with the next ones peeking out; Next sends the top card to the back.

Loading preview

Envelope

Interactive

A sealed envelope that opens on hover or click: the flap folds back and the letter slides out.