spotlight-card
A radial spotlight that follows the cursor across a card. Part of
motion-anything; obeys MOTION-SPEC.md. Technique
popularized by Aceternity UI, reimplemented dependency-free.
When to use it
- Feature cards, pricing tiles, or a card grid where one should light up under the pointer.
When NOT to use it (restraint)
- Text-dense reading surfaces — the glow distracts. Keep it low-contrast and subtle.
- Touch-only contexts — there is no cursor; it falls back to a static border automatically.
How to apply
- Copy
spotlight-card.cssandspotlight-card.jsinto the project, and link them. - Mark the card:
<div class="spotlight"> … </div> - Auto-attaches to
.spotlight. JS writes--mx/--my; the CSS paints the glow there.
Accessibility & performance
- Disabled under
prefers-reduced-motionand on(hover: none)touch devices (static border stays). - Paints a radial-gradient only — no layout thrash.
Framework notes
- React: call
attachSpotlight(ref.current)inuseEffect, guarded by the same checks.