Custom cursor
The emmetts.dev spring cursor, with shared motion and customizable colors.
Use the shared cursor with frosted dropdowns and the paired-logo footer on every CDN-based site.
Preview
Move anywhere on this page. Hover a button or link to trace its outline. Move away to return to the circle.
The cursor stays a little circle while you hover or click into a text field. Start typing: the circle compresses, moves to the insertion point, and becomes the typing caret. Move the mouse to release it back into the circle. The gentle border ripple settles when the field is focused. Selection and resize controls keep their native behavior. Touch keeps native behavior; reduced motion removes travel, squash-and-stretch, blinking, and the wave. The selected color adapts to light and dark surfaces while text and graphics still blend beneath it.
The cursor runs across this website. These color choices apply while you visit this guide.
Install
Place the element in the page body and load the script after it:
<shaughv-cursor color="orange"></shaughv-cursor>
<script defer src="https://cdn.shaughv.com/js/shaughv-cursor.js?v=2026-10-21.4"></script>
<script defer data-auto src="https://cdn.shaughv.com/js/shaughv-dropdown.js?v=2026-10-21.2"></script>
Agents can read usage.components.cursor in the live catalog for ready-to-copy HTML and JavaScript recipes, defaults, and the color contract. Replace the example color with the site’s base color; inversion and snapping need no extra configuration.
Use one instance per page. Sites loading the hosted script receive component changes as their cached copy refreshes; custom color options remain intact. For an immediate update, copy the current versioned script URL from this guide. See how CDN updates reach your site. Loading the script alone does not change the cursor. Removing the element restores the normal cursor. No React, Tailwind, or Framer Motion is required.
Install the frosted dropdown asset with the cursor. OS-native select popups live outside the page, so they cannot display its custom pointer. The shared dropdown renders options on the page and keeps the cursor above the open menu, including in modal dialogs. Its dedicated guide covers labels, forms, keyboard navigation, theme tokens, and cleanup. Multiple selects, native listboxes, and explicit OS-specific controls retain their native behavior.
Read usage.site_defaults and usage.components.dropdown alongside the cursor metadata. The page also needs the footer’s two logos and copyright; on a full-screen design, place that footer below the main viewport.
Customize
| Preset | Value |
|---|---|
orange (default) |
#FF5E1A |
sage (vintage sage) |
#5B8A5B |
black |
#000000 |
white |
#FFFFFF |
Use any valid CSS color, including a custom property available on the document body. These presets match the CDN’s orange motion example and vintage sage identity; they are available as ShaughvCursor.colors and in the cursor metadata.
<shaughv-cursor color="#8359c7"></shaughv-cursor>
<!-- Or color="var(--site-accent)" -->
Difference blending calibrates its ink against the surrounding CSS background, so the selected base color remains recognizable in light and dark themes instead of turning into its complement. Text and contrasting graphics beneath it still react to the blend. Calibration updates on pointer movement and ancestor theme/style changes. Outlines use the surface outside the control.
Calibration uses composited CSS background colors, not image pixels. Photos, gradients, filters, overlapping layers, and colors outside the blend’s available range can shift the result. Black on dark and white on light remain low contrast; choose a contrasting preset. Use blend="normal" for unblended color. Colors with their own alpha multiply the 90% element opacity.
<shaughv-cursor color="black" blend="normal"></shaughv-cursor>
Behavior
Position and shape share the MCP spring: mass 0.4, damping 35, and stiffness 1400. A hovered button or link smoothly attracts the cursor to its center. The filled circle becomes a crisp 2 px outline with a 3 px clear gap outside the control border (5 px to the outer edge) and corners based on the control. The outline stays centered so it does not drift into the button border. Text links get extra breathing room: a 7 px clear gap on the left and right and 5 px above and below (9 px and 7 px to the outer edge). This decoration may overlap nearby text without changing layout or the clickable area. Leaving it smoothly restores the circle. The animation stops when it settles.
This works automatically for links with href, buttons (including input buttons), closed selects, summaries, and controls with button, link, combobox, tab, menu item, checkbox, radio, or switch roles. No sidebar wrapper or special attribute is needed. Use data-magnetic for additional custom targets. Native checkboxes and radio buttons attract a 6 px dot within 24 px of their center, releasing beyond 32 px; this applies only while the actual control or its clickable label is under the pointer. Nothing moves the real mouse position or changes where clicks land.
Icon-only buttons and links, including hamburger/menu icons, keep a filled circle that springs from 16 px to 24 px at the pointer instead of tracing a box. Detection ignores SVG titles and visually hidden accessible labels. For a custom icon font or unusual markup, set data-cursor="icon" on the control. Frosted dropdown triggers and option rows get the outline throughout the open menu. Native exceptions restore the system pointer inside their OS option popup.
The custom cursor stays on page elements by default, including color pickers, sliders, disabled controls, newly inserted elements, pseudo-elements, and open shadow components. Color pickers and other inputs without a dedicated interaction gently enlarge the circle to 24 px without an outline. Unknown content keeps the regular 16 px circle. Site-defined text, resize, grab, wait, and precision cursor styles do not switch it back to the system pointer. Text fields keep the circle at the mouse alongside their border decoration until typing moves it to the insertion point. Resize handles, scrollbars, and input accessories keep their normal mechanics with the custom circle. Pointer suppression stays active during target changes; conflicting inline cursor styles are temporarily overridden and restored on cleanup. The component supplies its own page-wide hiding rule while active, so you do not need to add permanent cursor: none CSS.
While the page or a nested container scrolls, the cursor keeps a small circle at the mouse instead of outlining each control passing underneath. After scrolling stops, it finds the element now beneath the mouse and restores the appropriate hover shape. Window resizing and newly inserted content also keep the custom pointer active. Scrolling inside an editor continues to track its typing caret.
Links, buttons, summaries, button/link roles, and [data-magnetic] targets expand the circle. The marker also works on descendants. It does not move the target itself: the original site’s magnetic button movement belongs to a separate component.
<span data-magnetic>Custom interactive target</span>
<div data-cursor="native">Keep the site's native cursor in this region</div>
Text fields and editable content use the circle-to-caret and border interaction described above while keeping native editing mechanics. Only explicit data-cursor="native" regions opt out. Browser/OS picker windows, browser chrome, and embedded documents are outside the page cursor; frames need their own installation. Closed shadow roots with private cursor rules cannot be overridden by the parent page. The decoration hides on window exit, blur, and keyboard navigation, then returns on mouse movement. Native dialogs retain the cursor above their modal layer where supported, otherwise the normal pointer remains available. Touch and coarse pointers retain native behavior. With reduced motion, position and shape update immediately without spring travel.
Text fields
Text, search, email, URL, telephone, password, and number inputs, textareas, editable HTML, and textbox/searchbox roles receive a border-only hover interaction automatically. A gentle physical ripple travels around the outline on a five-second loop, moving the border by at most 2 px. When the field or an editing child receives focus, the ripple quickly eases flat, leaving a steady outline while typing. The border decoration stays outside the field contents.
The outline measures the actual width, height, and each corner, including rounded/pill fields, different corner radii, and percentage/elliptical radii. A resize observer follows textareas and growing editors without requiring another pointer movement. The same 2 px stroke and 3 px clear gap sit outside the field.
The small circle stays at the mouse while you hover or click into a text field. When you start typing, that same circle travels to the text insertion point with a 220 ms squash-and-stretch and morphs into a slim 2 px terminal-style caret. It follows typing, deletion, arrow navigation, wrapping, and scrolling; there is no second pointer or native caret while this custom bar is active. Moving the mouse releases the custom caret back to the mouse and morphs it into the circle again. The selected color and adaptive inversion apply in both shapes. Selection, scrolling, resize handles, and input accessories keep their native mechanics.
Text/search/URL/telephone inputs, textareas, and measurable contenteditable selections support this handoff. Password, email, and number inputs, IME composition, selected text, right-to-left or vertical editors, rotated surfaces, forced colors, and unmeasurable or offscreen insertion points retain the native caret. The component only hides it after a valid custom position is available and restores it on blur, fallback, or cleanup. It never intercepts editing events or retains the text used for measurement. Keyboard navigation keeps the site’s own focus indicator. Touch gets no custom effect; reduced motion removes the wave, travel, squash-and-stretch, and caret blinking. data-cursor="native" opts any field or editor out.
Lifecycle
After loading the script, mount once in a client lifecycle and call destroy() on unmount or route change. The target defaults to the full page; pass an element to limit it to a region. A new mount replaces the previous instance.
const cursor = window.ShaughvCursor.mount({ color: "sage" }); // difference by default
cursor.setColor("#8359c7");
cursor.setBlend("normal"); // optional solid color
// On unmount:
cursor.destroy();
// Load the CDN script before mounting this client component.
useEffect(() => {
const cursor = window.ShaughvCursor.mount({ color: "sage" });
return () => cursor.destroy();
}, []);
Reference
Agents may choose presets or custom colors to fit each website. Keep the shared spring, automatic control outlines, checkbox/radio snapping, difference blending default, and opacity; use the hosted component instead of reimplementing the animation. Discover this guide via usage.documentation.cursor in the catalog.