Cursor Text Reveal, animated React component
An ink lens follows the pointer across a card and shows a second sentence through it, dragging a tail of droplets on looser and looser springs so fast moves stretch into a drip. Press and hold (or Space) to flood the whole card with the reveal; it lets go with an overshoot.
- Free
- Motion Effects
- Hover
- Spring
Ink lens
Image lens
Like Cursor Text Reveal? 256 more are in Pro.
Pro unlocks all 256 Pro components, every template and block, and everything we release next. Cursor Text Reveal stays free.
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
The first rule of motion is clarity.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| baseText | string | — | Text everyone sees. |
| revealText | string | — | Text shown inside the lens. Defaults to baseText. |
| mode | "text" | "image" | "text" | Lens backdrop: solid ink, or an image / built-in gradient. |
| revealImage | string | — | Image URL inside the lens in image mode. Nothing is fetched unless you pass one. |
| revealImagePosition | string | "center" | CSS background-position for revealImage. |
| backgroundImage | string | — | Optional image URL behind the base text. |
| backgroundPosition | string | "center" | CSS background-position for backgroundImage. |
| maskSize | number | 120 | Lens radius in px while the pointer is over the card. |
| initialMaskSize | number | 0 | Lens radius at rest; 0 hides it. |
| smoothness | number | 0.18 | 0.04 to 0.6. Lower is snappier, higher drifts behind the pointer. |
| fontSize | string | "clamp(2rem, 5.2vw, 3.6rem)" | Font size for both text layers. |
| align | "left" | "center" | "right" | "center" | Text alignment. |
| enableGlow | boolean | true | Thin ring around the lens edge. |
| revealBackgroundClassName | string | — | Classes for the lens backdrop; replaces the default ink fill. |
| baseTextClassName | string | — | Classes for the base text. |
| revealTextClassName | string | — | Classes for the revealed text. |
| containerClassName | string | — | Classes for the card. |
| className | string | — | Classes for both text wrappers. |
| autoplay | boolean | false | Moves the lens along a slow figure-eight until a real pointer arrives. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry
Run this once per project. It writes the Nexus UI entry into
components.jsonfor you:npx shadcn@latest registry add "@nexus-labs=https://www.nexus-ui.com/api/registry/{name}"Type it exactly as shown.
{name}is filled in by the CLI with the component you ask for, so you never replace it.
- 3
Add the component
Run this from your project root. It adds the component, the helpers it imports and its npm packages.
npx shadcn@latest add @nexus-labs/cursor-text-reveal
- 4
Check what was added
With a project made as in the Quick Start (a
src/folder), these files land in it:components/cursor-text-reveal/cursor-text-reveal.tsxindex.ts - 5
Copying by hand? Skip the registry
Instead of steps 2 and 3 you can copy the files yourself, with no registry and no API key. Step 1 still applies, so that
cn()exists. Install the packages:npm install framer-motion
Then show the source and create each file at the path it gives:
- 6
Use it in a page
Installing only adds the files. Import the component in a page and render it. The Usage tab on the preview shows a fuller example with props:
// src/app/page.tsx import { CursorTextReveal } from "@/components/cursor-text-reveal"; export default function Page() { return ( <main> <CursorTextReveal /> </main> ); }
Like Cursor Text Reveal? 256 more are in Pro.
Pro unlocks all 256 Pro components, every template and block, and everything we release next. Cursor Text Reveal stays free.