Lean Card
A photo card that tilts in 3D toward the cursor with glare, a shifting shadow, floating layers, a caption tag that follows the pointer and a back side it flips to on click.
pixikit.com/docs/components/lean-card
Customize
Show tooltip
Display overlay content
Overlay depth30px
Flip on click
Rotate amplitude12°
Scale on hover1.05
Perspective800px
Radius15px
Smoothness0.60
Glare0.50
Glare color
Shadow0.50
Parallax1.0
Axis
Reverse
Track window
Floating
Gyroscope
Intro
Intro delay0ms
Props
35| Name | Type | Default | Description |
|---|---|---|---|
imageSrc | string | None | Photo that fills the card. |
altText | string | "Tilted card image" | Alternative text for the photo. |
children | ReactNode | None | Content on the face of the card, over the photo or instead of it. |
captionText | string | "" | Text in the small tag that follows the cursor and swings as it moves. |
showTooltip | boolean | true | Shows the caption tag on hover. |
overlayContent | ReactNode | null | Content that floats in front of the card, lifted off its surface. |
displayOverlayContent | boolean | false | Shows the overlay content. |
overlayDepth | number | 30 | How far the overlay floats in front, in px. |
backContent | ReactNode | null | Content for the back of the card. Clicking, tapping or pressing Enter flips the card over. |
flipOnClick | boolean | true | Flips the card when it is clicked. Needs backContent. |
flipped | boolean | None | Controls which side shows. Leave it unset to let clicks flip the card. |
onFlip | (flipped: boolean) => void | None | Called with the new side whenever the card is flipped. |
onClick | (event: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>) => void | None | Called when the card is clicked or activated with the keyboard. |
containerWidth | number | string | "100%" | Width of the area that reacts to the cursor. |
containerHeight | number | string | "300px" | Height of the area that reacts to the cursor. |
imageWidth | number | string | "300px" | Width of the card. |
imageHeight | number | string | "300px" | Height of the card. |
rotateAmplitude | number | 12 | How far the card tilts toward the cursor, in degrees. |
scaleOnHover | number | 1.05 | How much the card grows when hovered. |
perspective | number | string | 800 | Viewing distance in px. Lower values give a stronger 3D effect. |
radius | number | string | 15 | Corner radius of the card. |
smoothness | number | 0.6 | From 0 to 1. Low values snap to the cursor, high values glide and settle with a soft bounce. |
glare | number | 0.5 | Strength of the light that catches the surface and edges as the card tilts, from 0 to 1. |
glareColor | string | "#ffffff" | Color of the glare. |
shadow | number | 0.5 | Strength of the soft shadow under the card, which shifts and grows as the card lifts, from 0 to 1. |
parallax | number | 1 | How far layers and the photo shift with the tilt. 0 keeps everything flat. |
axis | "both" | "horizontal" | "vertical" | "both" | Limits the tilt to following the cursor left and right, or up and down. |
reverse | boolean | false | Tilts away from the cursor instead of toward it. |
trackWindow | boolean | false | The card follows the cursor anywhere on the page, not only while hovered. |
floating | boolean | false | The card drifts and sways gently while idle. |
gyroscope | boolean | true | Tilts the card as a phone or tablet is moved. Asks for permission on iOS on the first tap. |
intro | boolean | true | The card rises and settles into place when it first scrolls into view. |
introDelay | number | 0 | Wait before the intro, in ms. Stagger it across a row of cards. |
className | string | "" | Extra class names for the card. |
style | CSSProperties | None | Inline styles for the card. |