Skip to content

Tilt Card

Motion

React card that tilts toward the pointer in 3D with a moving glare and parallax children marked data-depth. Springs flat on leave, still for reduced motion.

src/registry/premium/tilt-card.tsx/r/tilt-card.json

Installation

bash
npx shadcn@latest add @minidev/tilt-card

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/tilt-card.json

Usage

tsx
import { TiltCard } from "@/components/ui/tilt-card"

export function Example() {
  return (
    <TiltCard />
  )
}

API reference

TiltCard props
PropTypeDefault
childrenReact.ReactNode-
maxTiltMaximum rotation in degrees on either axis.number12
glareGlare strength from 0 (off) to 1.number0.6
perspectivePerspective distance in pixels; smaller is more dramatic.number900
parallaxPixels of travel for a child with `data-depth="1"`; scale the number for more or less.number10
classNamestring-

When to use

Use it for a showcase card, a pricing hero or a product shot. Reach for CardTilt for a simpler tilt without glare or depth, and ShineBorder to draw the eye without motion.

Accessibility

  • The glare is an aria-hidden, pointer-events-none span; buttons inside stay clickable.
  • Under reduced motion the card stays flat, the glare is not rendered and data-depth transforms are cleared.

Frequently asked questions

How do I make parts of the card float above it?

Add data-depth to any descendant: <h3 data-depth="1">. It moves parallax pixels (default 10) per unit of depth with the pointer and lifts toward you while the card is lit. Layers are moved on the DOM directly, so React does not re-render.

What happens on phones?

Touch pointers are ignored, so the card stays flat and scrolling passes straight through. A mouse or pen tilts it up to maxTilt degrees (default 12).

TiltCard or CardTilt?

TiltCard adds a sliding glare, data-depth parallax and a perspective prop. CardTilt is the simpler tilt with a soft glow and a built-in title and body.

Dependencies

npm

lucide-reactmotion

Built from

Examples

Custom content

Any children work; here a customer card with the figure and the action on their own layers.

Subtle tilt

Lower maxTilt and glare for cards in a grid, where a strong effect would fight the content.

Deep parallax

A short perspective and a big parallax value make the layers float well clear of the card.

All Animated React components