Flip Card
betaA two-faced card that turns over in 3D: it leans toward the pointer, lifts as it turns, and a sheen sweeps across the faces.
- Display
- 1 file
- 2 npm packages
- Accessibility notes
- Animates with motion
pnpm dlx @dowel-ui/cli add flip-cardnpm packages installed: class-variance-authority, motion.
import { FlipCard } from "@/components/ui/flip-card";Default
Hover
Vertical Axis
Controlled
<FlipCard>
| Prop | Type | Default |
|---|---|---|
back (required)The face shown once turned over. | ReactNode | — |
front (required)The face shown at rest. | ReactNode | — |
axis
| "x" | "y" | "y" |
backClassNameClasses for the back face. | string | — |
defaultFlippedUncontrolled initial state. | boolean | false |
disabledFreezes the card on its current face. | boolean | false |
flipLabelThe flip button's accessible name. It is a toggle, so the name stays the same when pressed. | string | "Show back" |
flippedControlled: whether the back is showing. | boolean | — |
frontClassNameClasses for the front face. | string | — |
hideButtonHide the corner button. Only sensible with | boolean | false |
leanThe largest lean toward the pointer, in degrees. 0 keeps the card flat. | number | 6 |
onFlippedChange | (flipped: boolean) => void | — |
size | "sm" | "md" | "lg" | "md" |
trigger
| "click" | "hover" | "click" |
Plus every attribute of <div> except children.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes