Frame Cursor

A custom cursor that morphs into a dashed frame around interactive elements on hover. Features spring animations, marching ants dash animation, per-element color customization, and reduced motion support.

Hover over an interactive element

Installation

  1. 1

    Install the component:

    npx shadcn@latest add https://ui.amines.fun/r/frame-cursor.json
  2. 2

    Usage:

    jsx

    app/layout.jsx

    <FrameCursor  fill="#ffffff" stroke={1} cursorSize={22} // Props.../>

Props

PropTypeDefaultDescription
colorstring"#FF7138"Accent color for the cursor and the frame. Can be overridden per-element with data-cursor-color attribute.
fillboolean | stringtrueFrame tint. true = faint tint of color (8% opacity), false = none, or any CSS color string.
paddingnumber | [number, number][8, 4]Gap between element and frame. Single number for uniform padding, or [x, y] for horizontal/vertical.
strokenumber1Frame border width in pixels.
dashstring"4 3"Dash pattern for the frame border ("dash gap").
marchbooleantrueEnable marching ants animation (dashes crawl along the frame).
marchSpeednumber10Marching speed in pixels per second.
radiusnumber0Frame corner radius in pixels. 0 = sharp corners.
cursorSizenumber22Cursor size in pixels.
selectorstring"a, button, [role='button'], summary, [data-cursor]"CSS selector for elements that get framed. Add data-cursor to any element to opt-in.
ignorestring"[data-cursor-ignore]"CSS selector for elements to ignore (also ignores their children).
hideOnstring"input, textarea, select, [contenteditable='true']"CSS selector for elements where the custom cursor hides and native cursor returns.
hideNativebooleantrueHide the system cursor when the custom cursor is active.
morphobject{ type: "spring", stiffness: 380, damping: 34, mass: 0.8 }Framer Motion transition for cursor-to-frame morph animation.
moveobject{ type: "spring", stiffness: 520, damping: 44, mass: 0.7 }Framer Motion transition for frame traveling between elements.
pressScalenumber0.98Frame scale while mouse is pressed down (cursor shrinks too).
zIndexnumber9999Z-index for the cursor/frame layer.