Skip to content
English
Flip card comes with Pro. Its preview shows once you unlock it.

How it works

The root only provides perspective; inside it, both faces share one grid cell and the inner wrapper rotates 180° while the back is pre-rotated and backface-visibility hides the far side. Only transform animates. The card is not one big button, because faces often hold buttons and links; an invisible real button (aria-pressed) under the card handles keyboard and screen readers. Add data-flip-toggle to a button in a face to flip from it.

Use it for

  • Membership cards and coupons: summary on the front, details or a QR code on the back.
  • Flashcards: question on the front, answer on the back.
  • Tight spaces where extra details should not need a dialog or a new page.

Look elsewhere when

  • Critical information such as prices or warnings: show it directly instead of hiding it on the back.
  • Dozens of flippable cards in a list: use expandable details or a drawer.
  • Faces of very different heights: the shorter one leaves a large gap; use an accordion.

Usage

import { FlipCard } from './FlipCard.jsx'

export function MemberCard({ member }) {
  return (
    <FlipCard
      style={{ width: 300 }}
      toggleLabel="Show member perks"
      front={
        <>
          <h3>{member.title}</h3>
          <p>Click for perks</p>
        </>
      }
      back={
        <>
          <h3>Member perks</h3>
          <p>Free size upgrade on your birthday.</p>
          {/* Buttons in a face work as usual; one with data-flip-toggle flips back */}
          <button data-flip-toggle>Got it</button>
        </>
      }
    />
  )
}

// Controlled: <FlipCard flipped={flipped} onFlippedChange={setFlipped} trigger="hover" direction="vertical" ... />

Props

PropTypeDefaultWhat it does
frontReactNode—Front face content.
backReactNode—Back face content. The frame height is that of the taller face.
flippedboolean—Controlled: whether the back is showing.
defaultFlippedbooleanfalseUncontrolled: initial state.
onFlippedChange(flipped: boolean) => void—Called when the flip state changes.
trigger'click' | 'hover''click'click flips on empty face space; hover flips while the pointer is over the card. Touch falls back to tap; keyboard focus also flips it.
direction'horizontal' | 'vertical''horizontal'Turn around the vertical axis (left-right) or the horizontal axis (up-down).
durationnumber560Flip time in ms. When omitted it follows --ds-duration-slower.
toggleLabelstring'Show back'Screen reader name of the flip control. Make it specific, such as “Show member perks”.
...restHTMLAttributes<HTMLDivElement>—Other attributes go to the root element: className, style (width and --ds-flip-* variables).

Accessibility

  • The flip control is a real <button aria-pressed>: Tab reaches it, Enter and Space flip it; name it with toggleLabel.
  • Buttons, links and inputs inside a face keep their own semantics, and clicking them does not flip.
  • The hidden face is inert and aria-hidden, so it cannot be tabbed to, read or clicked.
  • If focus is in the face being hidden, it moves to the flip control instead of being lost.
  • Reduced motion replaces the rotation with a cross-fade.

Motion

A 560ms turn with a slight overshoot (cubic-bezier(0.34, 1.22, 0.64, 1)), transform only; the card shrinks to 0.98 while pressed. With reduced motion, a 240ms opacity cross-fade.

Add it to your project

Pro members copy a prompt and their coding agent installs the source, the same way as the free components.

FlipCard.jsxflip-card.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Cards
Animated border card comes with Pro. Its preview shows once you unlock it.
Border beam comes with Pro. Its preview shows once you unlock it.
Card lock sheet comes with Pro. Its preview shows once you unlock it.