Tilt card
A card that leans toward your pointer, with a sheen that follows it and layers that part in depth. Drag a finger across it on touch; let go and it springs back.
npx shadcn@latest add @captain/tilt-card
Above the treeline
Photograph by Chris Holgersson
Tilt card is a Pro component
The demo and the docs are free. The source comes with Pro, through this page, the shadcn CLI and the MCP.
Usage
import { TiltCard, TiltLayer } from "@/components/ui/tilt-card"
<TiltCard>
<TiltLayer depth={-1}><img src="/ridge.jpg" alt="" /></TiltLayer>
<TiltLayer depth={1.5}><h3>Above the treeline</h3></TiltLayer>
</TiltCard>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| children | ReactNode | The card face. Put TiltLayer elements inside for parallax. | |
| max | number | 9 | Largest lean in degrees. |
| sheen | boolean | true | The light that follows the pointer. |
| TiltLayer depth | number | 1 | How far a layer travels with the lean. Negative sits behind the face and is scaled up so its edges never show. |
Accessibility
- Purely visual: no role, no focus stop. Put links and buttons inside it as usual.
- Reduced motion keeps the sheen and drops the lean, the lift and the parallax.
- On touch it leans only while your finger drags across it; vertical scrolling still works.