Skip to Content
zjkm-ui
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.

Props
320px
0.35
<CursorSpotlight>
  <Card />
</CursorSpotlight>

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/cursor-spotlight.json
import { 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

PropTypeDefaultDescription
childrenReactNodeThe content the light sits under.
colorstring"#a78bfa"Colour of the light.
sizenumber320Diameter in pixels.
intensitynumber0.35Strength of the light, from 0 to 1.
classNamestringClasses for the wrapper.

With reduced motion, the light stays off.

On this page