Skip to content

Flip Card

Two faces, one card. Flip it with a keyboard-accessible control.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import FlipCard from "./FlipCard";
export default function Example() {
return (
<FlipCard
front={"A different perspective."}
back={"There is more to the story."}
frontBackground={"radial-gradient(ellipse at 100% 0%, #f2b394, transparent 60%), #d8cfe5"}
backBackground={"radial-gradient(ellipse at 0% 100%, #695777, transparent 70%), #27202e"}
frontColor={"#302336"}
backColor={"#f5eefa"}
frontLabel={"Turn it over"}
backLabel={"Back to the front"}
minHeight={320}
borderRadius={22}
style={{
"fontSize": "clamp(1.8rem, 3vw, 2.8rem)",
"fontWeight": 500,
"letterSpacing": "-.04em",
"lineHeight": 1.1
}}
/>
);
}

Using Flip Card

Provide front and back content separately, with labels that explain each face. minHeight should accommodate the taller face.

Use flipped and onFlip when a parent controls the card, or defaultFlipped to choose its initial face. Avoid placing essential instructions only on the hidden side.

Props

NameTypeRequiredDefaultDescription
frontReactNodeNoundefinedContent for the front face.
backReactNodeNoundefinedContent for the reverse face.
flippedbooleanNoundefinedOptional controlled state. Omit to let the component manage its own state.
defaultFlippedbooleanNofalseInitial state when uncontrolled.
onFlipfunctionNoundefinedCalled with the next boolean state when the toggle is pressed.
frontBackgroundstringNo"#dfd8ec"CSS background for the front face.
backBackgroundstringNo"#373044"CSS background for the back face.
frontColorstringNo"#292133"Front face text colour.
backColorstringNo"#f4ecff"Back face text colour.
frontLabelstringNo"Flip card"Accessible and visible label for the flip control on the front.
backLabelstringNo"Go back"Accessible and visible label for the return control.
minHeightnumber | stringNo300Minimum height in pixels or a CSS length. The component can fill a taller parent.
borderRadiusnumberNo22Corner radius in pixels.
classNamestringNo""Additional CSS classes, merged with the component styles.
styleCSSPropertiesNoundefinedInline styles for caller-defined sizing and visual overrides.

Related components

A paper flap lifts in 3D as a message slides out of its envelope.

A lightly textured receipt pairs precise item rows with a torn paper edge.

A suspended badge swings naturally after you drag and release its handle.

Fine metallic grooves catch a shifting iridescent pointer highlight.