A modern, interactive React component that provides a 3D "tilt" effect as the user moves their mouse across the card, animating rotation for a tactile, playful experience. Perfect for showcasing product cards, interactive UI elements, hero sections, and dashboards. Inspired by clean motion-driven web UI patterns.
You can install the TiltCard component with the following CLI command, or copy the implementation manually:
1npx shadcn@latest add http://localhost:3000/r/tilt-card.jsonTo use the TiltCard component, import it in your code:
1import { TiltCard } from '@/components/TiltCard';The TiltCard component accepts the following props:
| Prop | Type | Default | Description | Required |
|---|---|---|---|---|
children | React.ReactNode | - | The content to display inside the tilt card. | Yes |
1
2export const TiltCard = ({ children }: { children: React.ReactNode }) => { ... }
31<TiltCard>
2 <div className="text-center">
3 <h2 className="text-xl font-bold">Tilt Me</h2>
4 <p>Move your mouse over me.</p>
5 </div>
6</TiltCard>1<TiltCard>
2 <div className="flex flex-col items-center justify-center p-6 space-y-2">
3 <img src="https://avatars.githubusercontent.com/u/1?v=4" alt="github" className="w-14 h-14 rounded-full shadow" />
4 <h3 className="text-lg font-semibold">Profile Tilt</h3>
5 <p className="text-neutral-600 dark:text-neutral-300">Even avatars and stacked layouts can tilt in 3D!</p>
6 </div>
7</TiltCard>h-96 w-72 classes to match your layout.