crucıble

Loupe

Magnifier lens that turns any child — image, SVG, or subtree — into an inspectable surface. Spring-smoothed pointer follow or a pinned mode, a machined bezel with a velocity-driven specular arc, focus-blur on the surface behind, and full keyboard walking. Pure transform/clip compositing, zero canvas.

motionfree

Installation

CLI

npx shadcn@latest add @crucible/loupe

Manual — install dependencies, then copy the source

npm install motion

Props

PropTypeDefaultDescription
childrenReact.ReactNodeThe surface to inspect — an image, an SVG, or any React subtree.
zoomnumber1.6Magnification inside the lens.
sizenumber176Lens diameter, in px.
pinnedbooleanfalsePin the lens at a fixed spot instead of tracking the pointer.
pinnedPosition{ x: number; y: number }{ x: 0.5, y: 0.5 }Lens center as fractions of the surface (0–1) while pinned.
activebooleanControlled active state — when set, overrides internal hover/focus.
onActiveChange(active: boolean) => voidFires whenever the lens opens or closes (pointer, focus, or keyboard).
focusBlurbooleantrueSoftly blur + dim the surface outside the lens while it is active.
focusBlurStrengthnumber2Blur radius, in px, applied behind an active lens.
animateEntrancebooleantruePlay the fast scale-settle entrance when the lens appears.
keyboardStepnumber24Pixels the lens walks per arrow-key press while focused.
rimColorstring"rgba(255,255,255,0.72)"Rim + specular color of the machined bezel.
Also accepts all props of Omit<React.ComponentPropsWithoutRef<"div">, "children">they pass through to the underlying element.

Honors prefers-reduced-motion with a designed static fallback, and passes className through.