UniqueUI

3D Tilt Card

Perspective-shifting card that tilts toward the cursor with parallax layers and glare overlay.

npx uniqueui add 3d-tilt-card

Preview

Hover me

Move your cursor over this card to see the 3D tilt effect with glare.

Extra Tilt

This card has a stronger tilt angle for a more dramatic effect.

Usage

import { TiltCard } from "@/components/ui/3d-tilt-card";

export default function Example() {
  return (
    <div className="flex flex-wrap gap-8 items-center justify-center p-10 text-white">
      <TiltCard className="w-72 bg-gradient-to-br from-neutral-900 to-neutral-800 border border-neutral-700 rounded-xl p-6">
        <h3 className="text-xl font-bold mb-2">Hover me</h3>
        <p className="text-neutral-400 text-sm">
          Move your cursor over this card to see the 3D tilt effect with glare.
        </p>
        <div className="mt-4 h-24 rounded-lg bg-gradient-to-br from-purple-600/20 to-pink-600/20 border border-neutral-700/50" />
      </TiltCard>
      <TiltCard
        tiltMaxDeg={25}
        glare={true}
        className="w-72 bg-gradient-to-br from-purple-950 to-indigo-950 border border-purple-800/50 rounded-xl p-6"
      >
        <h3 className="text-xl font-bold mb-2 text-purple-200">Extra Tilt</h3>
        <p className="text-purple-300/60 text-sm">
          This card has a stronger tilt angle for a more dramatic effect.
        </p>
        <div className="mt-4 flex gap-2">
          <div className="h-12 w-12 rounded-lg bg-purple-500/20 border border-purple-500/30" />
          <div className="h-12 w-12 rounded-lg bg-pink-500/20 border border-pink-500/30" />
          <div className="h-12 w-12 rounded-lg bg-indigo-500/20 border border-indigo-500/30" />
        </div>
      </TiltCard>
    </div>
  );
}

Props

PropTypeDescription
childrenReact.ReactNodeThe element(s) suspended inside the 3D card layout.
classNamestringTailwind configuration applied directly to the physical card.
containerClassNamestringTailwind bounds defining the invisible hover hit-box.
tiltMaxDegnumberThe maximum angle the card aggressively pitches on hover.
perspectivenumberThe CSS perspective depth in pixels determining 3D deformation strength.
scalenumberFloat multiplier for card scaling when hovered (e.g. 1.05).
glarebooleanEnable a dynamic radial-gradient glare sweep that tracks the pointer.
glareMaxOpacitynumberMax brightness (0 to 1) for the dynamic glare effect.