Skip to content
English
Tilt card comes with Pro. Its preview shows once you unlock it.

How it works

Give one card the spotlight. Keep the rest of the page still.

Hover to tilt the card toward the pointer. The foreground lifts and a highlight follows the movement. Move away and the layers settle flat again.

Implementation details

The root owns perspective and never transforms; it is the thing measured, so the angles do not jitter as the card rotates. The inner __card rotates and scales. Updates are throttled with requestAnimationFrame. Enter eases in over 320ms, tracking takes 120ms, and leaving springs back over 700ms. Parallax layers lie flat at rest and only float with translateZ on hover. The glare is a double-size radial spot moved with transform.

Use it for

  • Product heroGive a product photo or membership card a sense of depth.
  • Showcase cardLift the title and price above the artwork on a landing page.
  • Collectible revealGive a newly revealed card or reward a tangible surface.

Look elsewhere when

  • Dense gridsUse a subtle lift so neighboring cards stay quiet.
  • Forms and small buttonsKeep controls still so the pointer can land precisely.
  • TouchscreensShow the resting card. A touch does not trigger tilt.

Usage

import { TiltCard, TiltLayer } from './TiltCard.jsx'

export function TripCard() {
  return (
    <TiltCard maxTilt={12} style={{ width: 300 }}>
      {/* The card face; round its corners with border-radius: inherit */}
      <div className="trip-face">
        <TiltLayer depth={18}>Skyline Air</TiltLayer>
        <TiltLayer depth={30}>
          <h3>Lisbon, 3 nights</h3>
        </TiltLayer>
        {/* A data-depth attribute works too */}
        <p data-depth="36">$680</p>
      </div>
    </TiltCard>
  )
}

Props

PropTypeDefaultWhat it does
maxTiltnumber12Maximum tilt angle in degrees, reached when the pointer is at the card edge.
glarebooleantrueShows the glare that follows the pointer.
glareOpacitynumber0.35Maximum glare opacity, 0 to 1.
scalenumber1.03Scale on hover; 1 means no scaling.
perspectivenumber900Perspective distance in px; smaller values look more dramatic.
childrenReactNode—The card face. The card has no background; its radius comes from --ds-tilt-radius (default 24px), so faces should use border-radius: inherit.
...restHTMLAttributes<HTMLDivElement>—Other attributes go to the root <div>; set the width with style or className.
TiltLayer.depthnumber24How far a parallax layer floats, in px. Or put data-depth="number" on any child.

Accessibility

  • When an element inside the card has keyboard focus, the card levels out and the glare hides, so focus rings and text stay clear.
  • With reduced motion enabled it does not tilt or float at all.
  • It reacts to mouse and pen only, not touch.
  • The glare layer is aria-hidden.

Motion

Enter 320ms ease-out; track 120ms ease-out; leave 700ms spring; layers float 360ms ease-out; glare in 240ms, out 360ms; shadow 360ms.

Add it to your project

Pro members copy a prompt and their coding agent installs the source, the same way as the free components.

TiltCard.jsxtilt-card.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Cards
Animated border card comes with Pro. Its preview shows once you unlock it.
Border beam comes with Pro. Its preview shows once you unlock it.
Card lock sheet comes with Pro. Its preview shows once you unlock it.