Components
Cursor Spotlight
A spotlight that follows the cursor.
Move your mouse over this card
The light follows the pointer and fades when it leaves.
<CursorSpotlight>
<Card />
</CursorSpotlight>Installation
npx shadcn@latest add https://ui.zjkm.tech/r/cursor-spotlight.jsonimport { CursorSpotlight } from "@/components/cursor-spotlight"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
A soft light sits under your content and follows the mouse while it's over the element, then fades when it leaves. Touch doesn't trigger it.
import { CursorSpotlight } from "@/components/cursor-spotlight";
export function PricingCard() {
return (
<CursorSpotlight className="rounded-xl border p-8">
<h3>Team plan</h3>
</CursorSpotlight>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | The content the light sits under. | |
color | string | "#a78bfa" | Colour of the light. |
size | number | 320 | Diameter in pixels. |
intensity | number | 0.35 | Strength of the light, from 0 to 1. |
className | string | Classes for the wrapper. |
With reduced motion, the light stays off.