Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/magical/llms.txt
Use this file to discover all available pages before exploring further.
CustomCursor replaces the browser’s native pointer with two layered elements — a sharp mint dot and a diffuse violet glow orb — both driven by Framer Motion spring physics. It automatically detects when the pointer hovers over interactive elements and responds with a scale transformation, giving users tactile visual feedback.
Device Detection
The component only renders on pointer-fine devices (i.e. mice and trackpads). On touch screens and stylus-only devices, it returnsnull immediately, leaving the default touch interaction model intact.
Detection is performed by checking the (pointer: fine) media query via the browser’s matchMedia API on mount. No cursor elements are ever added to the DOM on non-fine-pointer devices.
Cursor Elements
Twomotion.div elements are rendered at position: fixed, anchored to top-0 left-0 and translated to follow the pointer. Each element is offset by half its own size so it stays centered on the cursor position — the dot animates to x: mouseX - 6, y: mouseY - 6 (half of 12 px) and the glow orb to x: mouseX - 64, y: mouseY - 64 (half of 128 px):
Dot
| Property | Value |
|---|---|
| Size | w-3 h-3 (12 × 12 px) |
| Colour | bg-mystic-mint |
| Z-index | z-[100] |
| Blend mode | mix-blend-screen |
| Spring stiffness | 500 |
| Spring damping | 28 |
| Spring mass | 0.5 |
| Scale on hover | 0.5× |
Glow Orb
| Property | Value |
|---|---|
| Size | w-32 h-32 (128 × 128 px) |
| Colour | bg-mystic-violet/10 |
| Blur | blur-xl |
| Z-index | z-[99] |
| Spring stiffness | 250 |
| Spring damping | 20 |
| Spring mass | 0.8 |
| Scale on hover | 1.5× |
Hover Detection
The component attaches amouseover listener to window and checks whether the element under the pointer matches any of the following selectors:
hovering state is set to true, triggering the scale transforms on both cursor elements simultaneously. Moving off an interactive element resets both to their default scales.
Required CSS
For the custom cursor to display correctly, the native browser cursor must be hidden globally for pointer-fine sessions. Add the following rule to your global stylesheet:Usage
Place<CustomCursor /> once near the root of your app, outside any scroll containers, so its position: fixed elements are anchored to the viewport: