Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/neocities-dev/llms.txt
Use this file to discover all available pages before exploring further.
CustomCursor overrides the browser’s default pointer with a custom pixel-art SVG cursor and a short magenta particle trail. It uses fixed positioning and a high z-index to float above all other content, and it adds the custom-cursor-active class to document.body to hide the system cursor on all child elements.
No props
CustomCursor accepts no props. Mount it once at the application root, as a sibling to the main app shell:
CustomCursor outside FakeBrowserChrome ensures the custom cursor covers the entire viewport, including the browser-chrome title bar and toolbar, not just the content area.
How it works
Mouse tracking
Inside auseEffect that runs once on mount, CustomCursor attaches a mousemove listener to window:
CustomCursor only on desktop breakpoints.
Trail particle decay
A seconduseEffect watches the trail state array. Whenever new particles are present, it schedules a 50 ms setTimeout that removes the oldest particle from the front of the array:
The custom-cursor-active body class
Adding custom-cursor-active to document.body is the trigger for a CSS rule in assets/main.css that hides the default cursor across all elements:
Rendered output
CustomCursor renders a React Fragment with two layers:
1. Primary cursor SVG
- Anchored at
top-0 left-0and moved with CSStransform: translate(x, y)for GPU-accelerated, jank-free tracking. mix-blend-differenceinverts the colours of whatever is beneath the cursor, making it visible on both light and dark backgrounds.pointer-events-noneensures the cursor overlay never intercepts clicks intended for elements below it.z-[9999]keeps it above all other content includingFakeBrowserChrome.
2. Trail particles
Each of up to five trail particles renders as a smallw-2 h-2 (8×8 px) magenta square at z-[9998]:
opacity is graduated: older particles (lower index) are more transparent and newer particles are more opaque, up to a maximum of 0.5. The +4 pixel offset centres each particle beneath the cursor tip.
Fallback behaviour
CustomCursor only activates when JavaScript is running. If JavaScript is disabled or blocked, the custom-cursor-active class is never added to document.body and the browser’s default system cursor is used instead — no functionality is lost.
On touch devices (phones and tablets) where there is no mouse pointer, the
mousemove event never fires. CustomCursor mounts without error but renders nothing visible. The custom-cursor-active class is still added to document.body, but since there is no pointer, it has no practical effect.