Flip cardPro
A two-sided card that flips in 3D on click, Enter or hover.
pnpm dlx shadcn@latest add @lode/flip-cardPro
$12/mo
Click to see what's included
Everything in Pro
- All Pro components
- Blocks and templates
- CLI with API keys
- Priority support
Ada Lovelace
ada@analytical.engine
+44 20 7946 0958
London
When to use
- Reveal details on demand: plan features, flashcards, contact cards.
When not to use
- Content that must be compared side by side: show both faces.
- Faces containing form fields or buttons: use a dialog.
Installation
pnpm dlx shadcn@latest add @lode/flip-cardPro components need an API key and the registry in components.json. See CLI and API keys.
1Install the dependencies
npm install motion2Copy the source into your project
Usage
Import it from @/components/ui/flip-card after installing.
import { FlipCard } from "@/components/ui/flip-card";
export function PlanCard() {
return (
<FlipCard
label="Pro plan"
className="h-72 w-60"
front={<div className="p-5">Pro · $12/mo</div>}
back={<ul className="p-5">…features</ul>}
/>
);
}API reference
FlipCard
Two absolutely positioned faces in a 3D container. Size it with className.
front / back
ReactNode
The two faces; keep them non-interactive.
label
string
Names the card; the current face is appended.
trigger= "click"
"click" | "hover"
Click (and Enter or Space) or hover and focus.
axis= "y"
"x" | "y"
Flip around the vertical or horizontal axis.
flipped / defaultFlipped / onFlippedChange
boolean
Controlled or uncontrolled state.
| Prop | Type | Default | Description |
|---|---|---|---|
| front / back | ReactNode | – | The two faces; keep them non-interactive. |
| label | string | – | Names the card; the current face is appended. |
| trigger | "click" | "hover" | "click" | Click (and Enter or Space) or hover and focus. |
| axis | "x" | "y" | "y" | Flip around the vertical or horizontal axis. |
| flipped / defaultFlipped / onFlippedChange | boolean | – | Controlled or uncontrolled state. |
Keyboard interactions
| Keys | Action |
|---|---|
| EnterorSpace | Flip (click trigger) |
| Tab | Focus flips it over (hover trigger) |
Accessibility
- Click mode is a toggle button with aria-pressed.
- The hidden face is aria-hidden, so only the visible side is read.
- Under reduced motion the faces cross-fade instead of rotating.
Motion
- A spring rotation (stiffness 140, damping 18) with backface hiding.
Responsive behavior
- Give it explicit dimensions; faces fill the card.
Performance
- One transformed element; both faces stay mounted.
Notes for AI
- Always set a height: faces are absolutely positioned.
- Use trigger="hover" only for decorative reveals.
This page as Markdown, for assistants and coding agents:
/components/flip-card/markdownThe full library index for assistants is at /llms.txt.
Related
Lode·229 doc pages·llms.txt