npx shadcn@latest add https://components.bksh.site/r/magnetic-card.json

Mouse

Magnetic Card

A card that tilts in 3D toward the cursor, with a moving glare.

Magnetic Card

Move your cursor across me.

Example.tsx
import { MagneticCard } from "@/components/better/magnetic-card"
export function Example() {
return (
<MagneticCard
tilt={12}
drift={10}
glare={true}
title="Magnetic Card"
subtitle="Move your cursor across me."
className="w-64"
/>
)
}

Dependencies

Props

PropTypeDefaultDescription
childrenReactNode
classNamestring
tiltnumber12Max tilt in degrees at the card's edges.
driftnumber10How far the card drifts toward the cursor, in px.
glarebooleantrueShow the moving glare highlight.
imagestringOptional image URL shown as a banner (not an upload — just a src to display).
titlestringTitle for the built-in card layout. Provide this (or `image`) to use it instead of children.
subtitlestringSubtitle under the title.