Overview
Cursor Glow wraps any content in a surface lit by a soft radial light that trails the mouse. The position is eased in a requestAnimationFrame loop and written straight to CSS variables (--glow-x, --glow-y), so React never re-renders on pointer move and children can reuse the variables. The glow fades in and out on enter and leave, optionally lights the container's 1px border, and stays off for touch input.
01Installation
Method 01 · Registry
CLI verifiedUses the shadcn CLI in a project initialised with shadcn init. Installs the file to components/ui/cursor-glow.tsx and adds its dependencies.
npx shadcn@latest add https://wancraft.my/r/cursor-glow.jsonMethod 02 · Copy and paste
- 1. No extra dependencies — React and Tailwind CSS only.
- 2. Copy the source from the Code tab into
components/ui/cursor-glow.tsx. - 3. Import it and adjust props.
- Dependencies
- None
- Peer
- react ≥ 18, tailwindcss ≥ 4
- Added
- 1 Oct 2026
- Updated
- —
02Usage
The default configuration. Change properties above to generate a tailored example in the Usage tab.
import { CursorGlow } from "@/components/ui/cursor-glow";
export function CursorGlowExample() {
return (
<CursorGlow
className="rounded-2xl border border-zinc-900/10 bg-white p-8 dark:border-white/10 dark:bg-zinc-950"
>
<h3 className="text-lg font-medium">Lit by your cursor</h3>
<p className="mt-2 text-sm text-zinc-500">Move the mouse across this panel.</p>
</CursorGlow>
);
}03Props
| Prop | Type | Default | Description |
|---|---|---|---|
| radius | number | 220 | Glow radius in px; also sizes the border light. |
| blur | number | 40 | Additional blur in px. |
| color | string | "#FF7448" | Glow colour (any CSS colour). |
| intensity | number | 0.45 | Peak glow opacity (0–1). |
| easing | number | 0.15 | Per-frame smoothing (0.02–1), normalised to 60 fps. |
| border | boolean | true | Lights the container's 1px edge near the pointer (inherits border radius). |
| ...props | HTMLAttributes<HTMLDivElement> | — | Forwarded to the root; ref is forwarded. Pointer handlers you pass are still called. |
04Features
- 01rAF-eased position written to CSS variables — no re-render per move
- 02Frame-rate independent smoothing; loop stops as soon as the glow settles
- 03Fades in/out on enter/leave, clipped to the container
- 04Optional 1px border light using a masked radial gradient
- 05Exposes --glow-x / --glow-y to children for custom effects
05Accessibility
- Glow layers are aria-hidden and ignore pointer events — content stays fully interactive.
- Touch and pen input never show the glow.
- prefers-reduced-motion snaps the glow to the pointer and disables fade transitions.