Skip to content
Browse docs and components

Tilt Card

tilt-card

A card that leans toward the pointer in 3D with a highlight sliding across it, then settles flat when the pointer leaves. It is driven by CSS variables with no re-renders, and it stays flat for touch and reduced motion.

Responsive

Install

$npxshadcnadd@forme/tilt-card

Adds the component, its registry dependencies, and the token stylesheet you import once.

Usage

import { TiltCard } from "@/components/forme/tilt-card/tilt-card";

<TiltCard max={8} glare>
  <img src="/cover.jpg" alt="The album cover" className="rounded-2xl" />
</TiltCard>

When to use

Reach for it

  • A single showcase object, like a product shot, a card design or an album cover.

Use something else

  • Grids of interactive cards; tilting targets are harder to click.
  • Anything with text people need to read while it moves.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

TiltCard

A card that leans toward the pointer, like a print held up to the light.

PropTypeDefaultDescription
maxnumber8Maximum tilt in degrees at the card's edge.
glarebooleantrueAdds a highlight that slides across the card as it tilts.

Also takes every prop of <div> attributes.

Accessibility

  • The glare layer is decorative and hidden from assistive technology.

Motion

  • Rotation and glare are custom properties set on pointer move and smoothed by a CSS transition, so tilting costs no renders.
  • It settles back flat when the pointer leaves; max caps the lean in degrees.
  • Reduced motion gives a flat card.

Responsive behaviour

  • Only a mouse tilts it. Under a finger, tilting would fight the scroll, so touch gets a flat card.