115 Components
Text Hover Lens
TextInteractive text component where hovering opens a circular lens under the cursor with spring physics, revealing a contrasting color layer with optional magnification.
NewHoverLensSpringReveal
HOVER TO REVEAL
Move cursor across typography • Snappy spring lens follows pointerInstallation
Install directly into your project using the shadcn CLI or copy the source code manually.
Requires:framer-motionclsxtailwind-merge
$npx shadcn@latest add "https://boseui.site/r/text-hover-lens.json"
Props
TypeScript props supported by <TextHoverLens />.
| Prop | Type | Default | Description |
|---|---|---|---|
| textrequired | string | — | The text string to display and reveal through the lens. |
| lensColor | string | "#0d9488" | Background color of the circular lens disc. Accepts any valid CSS color. |
| lensTextColor | string | "#ffffff" | Color of the revealed text inside the lens disc. Must provide AA contrast against lensColor. |
| textColor | string | "currentColor" | Color of the base text outside the lens. |
| lensSize | number | 120 | Diameter of the circular lens in pixels when fully open. |
| magnify | number | 1 | Scale multiplier for text inside the lens. 1 = no zoom, 1.2 = slight zoom. |
| stiffness | number | 380 | Hooke's Law spring stiffness coefficient matching the Snappy preset. |
| damping | number | 24 | Spring damping coefficient controlling oscillation decay matching the Snappy preset. |
| className | string | undefined | Additional Tailwind or CSS classes applied to the outer wrapper. |
Key Features
- Dual-layer text architecture with zero layout shift and identical font metrics.
- Dynamic clip-path circle driven by Framer Motion motion values without React re-renders during mouse movement.
- Snappy spring physics preset (stiffness 380, damping 24) for natural cursor follow and soft open/close overshoot.
- Customizable magnification scale, lens diameter, and full CSS color support (hex, rgb, hsl, CSS variables).
- Touch device support with touch-down reveal and non-blocking page scroll.
- Respects system prefers-reduced-motion by bypassing spring physics for instant alignment.
Keyboard & Accessibility
- Aria-hidden on the decorative lens layer ensures screen readers announce the text exactly once.
- Base layer text remains fully selectable with pointer-events: none on the overlay.
- Respects prefers-reduced-motion settings out of the box without jarring layout shifts.