One soft beam follows the pointer across a grid, lighting the borders and faces of the cards it passes.
A card with a soft glow that tracks the pointer across its surface.
Customize
Usage
import { SpotlightCard } from "@/components/motionkit/spotlight-card";
<SpotlightCard>
<h3>Realtime sync</h3>
<p>Changes appear everywhere instantly.</p>
</SpotlightCard>Motion
The exact curves this component runs, plotted with Motion's own maths.
Glow fade-in
Pointer enters the card
Feature grids, pricing tiers and dashboards on dark pages, where a quiet response to the pointer makes static cards feel alive.
The card tracks the pointer's position inside itself in two Motion values. A template string turns them into a radial gradient centred on the cursor, painted on a layer behind the content. Because the values feed the style directly, moving the pointer never re-renders React.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/spotlight-card.jsonnpm install motionSave as components/motionkit/spotlight-card.tsx.
"use client";
import type { ComponentProps, PointerEvent } from "react";
import { motion, useMotionTemplate, useMotionValue } from "motion/react";
type SpotlightCardProps = ComponentProps<"div"> & {
/** Any CSS color for the glow. */
color?: string;
/** Glow radius in pixels. */
radius?: number;
};
export function SpotlightCard({
color = "rgb(14 124 134 / 0.32)",
radius = 260,
className = "",
children,
onPointerMove,
...props
}: SpotlightCardProps) {
const mouseX = useMotionValue(-radius);
const mouseY = useMotionValue(-radius);
const background = useMotionTemplate`radial-gradient(${radius}px circle at ${mouseX}px ${mouseY}px, ${color}, transparent 80%)`;
function handleMove(event: PointerEvent<HTMLDivElement>) {
onPointerMove?.(event);
const rect = event.currentTarget.getBoundingClientRect();
mouseX.set(event.clientX - rect.left);
mouseY.set(event.clientY - rect.top);
}
return (
<div
onPointerMove={handleMove}
className={`group relative overflow-hidden rounded-2xl border border-white/10 bg-[#0C1010] p-6 ${className}`}
{...props}
>
<motion.div
aria-hidden
style={{ background }}
className="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100"
/>
<div className="relative">{children}</div>
</div>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| color | string | rgb(14 124 134 / 0.32) | Any CSS color for the glow. |
| radius | number | 260 | Glow radius in pixels. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Only the motion package, beside React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/spotlight-card.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
Nothing animates on its own. The glow tracks the pointer directly with no easing.
One soft beam follows the pointer across a grid, lighting the borders and faces of the cards it passes.
A 3D card that tilts toward the pointer, with an optional moving glare.
A card that tilts toward the cursor while its layers float at different depths, so each moves at its own speed.
Realtime sync
Move your cursor across this card.