Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/webmaster/llms.txt
Use this file to discover all available pages before exploring further.
SparkleCursor is a globally-mounted overlay that tracks the user’s mouse and emits a trail of ✦ sparkle particles in four retro colors. Each particle scales in with a animate-ping pulse, then fades out after 800ms — creating the shimmery cursor effect that defined the golden age of personal homepages. Because the container is fixed and pointer-events-none, it sits above all page content without ever blocking a click.
Props
SparkleCursor accepts no props. It reads directly from DOM mouse events and manages its own internal state.
This component takes no props. Drop it once in your app root and it works automatically across every page.
Sparkle Colors
Each particle is assigned one of four colors at random:| Color name | Hex value | Preview |
|---|---|---|
| Hot pink | #FF69B4 | 🩷 |
| Turquoise | #00CED1 | 🩵 |
| Lemon chiffon | #FFFACD | 🌕 |
| White | #FFFFFF | ⬜ |
Particle Behavior
- Character:
✦(Black Four Pointed Star), rendered viafont-pixel - Size: random between
5pxand15px(Math.random() * 10 + 5) - Lifetime: each sparkle is removed from state after 800ms via
setTimeout - Animation class:
animate-ping— Tailwind’s scale-out pulse that creates the twinkling effect - Text shadow:
0 0 2px #000— thin dark outline so white sparks stay visible on light backgrounds - Transform on spawn:
translate(-50%, -50%) translateY(20px) rotate(<random 0–180deg>)withopacity: 0— the sparkle begins offset and invisible, then fades/translates via a CSStransitionover 0.8s
Positioning & Layering
The root container usespointer-events-none fixed inset-0 z-[9999] overflow-hidden. This means:
fixed inset-0— stretches edge-to-edge over the full viewportz-[9999]— sits on top of every other element including modals and overlayspointer-events-none— mouse events pass through completely; nothing is blockedoverflow-hidden— prevents sparkles near viewport edges from creating scrollbars
Accessibility: prefers-reduced-motion
Before attaching the mousemove listener, the component checks:
mousemove handler returns early and no sparkles are ever created. The component still mounts and renders its container div, but it remains empty.
The check runs inside every
mousemove event, not just on mount — so if the user toggles their accessibility setting while the page is open, the effect stops immediately without a re-render.Core Implementation
The component usesuseState to hold an array of active sparkle objects and useEffect to attach the global mousemove listener. Each sparkle is a plain object:
Usage
Place<SparkleCursor /> once at the top level of your app — inside App.tsx or main.jsx alongside your router. Placing it at the root ensures it covers every route automatically.