Toggle Sidebar B
AppearanceLight & dark mode D

Flip Card

Two-faced card that flips in 3D on a click, a drag or a flick, settling on a spring that carries your release velocity, with an optional cursor tilt, a sheen that follows the pointer and a shadow that narrows as it turns edge on.

Default

Click the card, or drag and flick it to turn it over. Hover to see it lean toward the cursor.

Dark previewReplay previewOpen in new tab
Wooded Landscape, 17th century

Customize

Axis
Drag Distance0
Tilt Max12
Glare Opacity0.22
Hover Scale1.03
Perspective1100
Stiffness170
Damping20
Width300
Height400
Radius22
Background
Color
Shadow Color
Shadow Opacity0.45

API Reference

FlipCard

PropTypeDefaultDescription
flippedbooleanundefinedControlled state, usable with v-model:flipped: true shows the back. Omit it to let the card manage itself.
defaultFlippedbooleanfalseStart on the back face.
axis'y' | 'x''y'y turns the card sideways and drags horizontally. x turns it over the top and drags vertically.
flipOnClickbooleantrueA press without movement flips the card.
draggablebooleantrueDrag to turn the card by hand. On release it springs to the nearest face, carrying the flick velocity.
dragDistancenumber0Pixels of drag for a half turn. 0 uses the card width, or its height on the x axis.
tiltbooleantrueThe card leans toward the cursor on hover.
tiltMaxnumber12Largest tilt angle in degrees.
glarebooleantrueA soft sheen that follows the cursor.
glareOpacitynumber0.22Strength of the sheen at its centre.
hoverScalenumber1.03Lift while hovered or held.
perspectivenumber1100Viewing distance in px. Smaller is more dramatic.
stiffnessnumber170Stiffness of the flip spring.
dampingnumber20Damping of the flip spring. Lower overshoots more.
widthnumber300Card width in px, capped at the parent.
heightnumber400Card height in px.
radiusnumber22Corner radius in px.
backgroundstring'#27272a'Surface of both faces.
colorstring'#f5f5f5'Text colour of both faces.
shadowbooleantrueA soft shadow beneath the card that narrows as it turns edge on.
shadowColorstring'#000000'Shadow colour.
shadowOpacitynumber0.45Shadow strength.
disabledbooleanfalseDimmed, flat and inert.
ariaLabelstring'Flip card'Accessible name. The face is carried by aria-pressed.
EventDescription
update:flippedA click, drag, flick or key landed on the other face, with the new state.
flip-changeSame moment as update:flipped.
SlotDescription
frontContent of the front face.
backContent of the back face.

Accessibility

Keyboard shortcuts and ARIA behavior.

Shortcut Description
Enter + SpaceFlips the card.
  • The card is a button with aria-pressed, and the hidden face is inert and removed from the accessibility tree.
  • With prefers-reduced-motion the card crossfades between its faces and ignores drag and tilt.