Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Hover Highlight Text, animated React component

A headline you read with a highlighter: words near the pointer turn from grey to ink and a marker stroke swipes in under each one with a small overshoot. As the pointer moves on, the strokes linger and retract one after another like a comet tail. Also includes Marker Annotations: Hand-drawn marks play over your copy in reading order as it scrolls in: a highlighter pass across line breaks, a scribbled underline, a loose circle and a strike-through.

  • Free
  • Motion Effects
  • Hover
  • Spring

Hover Highlight Text

Marker Annotations

Like Hover Highlight Text? 256 more are in Pro.

Pro unlocks all 256 Pro components, every template and block, and everything we release next. Hover Highlight Text stays free.

Play with it

Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.

Build interfaces people remember long after they close the tab.

Props

PropTypeDefaultWhat it does
text—The sentence to highlight.
as"h2"Element used for the text.
reach40How far from the pointer, in px, a word still gets highlighted.
linger0.9Seconds a stroke takes to retract after the pointer moves on.
markerColor—Marker colour. Defaults to a highlighter yellow, softer in dark mode.
baseColor—Colour of words that are not highlighted. Defaults to #86868b (#6e6e73 in dark mode).
highlightColor—Colour of highlighted words. Defaults to the ink colour.
springConfig{ stiffness: 320, damping: 17, mass: 0.7 }Spring for the marker stroke; the default overshoots a little.
baseClassName—Classes for the text element (size, weight, width).
highlightClassName—Classes for every marker stroke. A bg-* class replaces markerColor.
containerClassName—Classes for the wrapper that listens to the pointer.
disabledfalseShows plain text with no effect.
autoplayfalseSweeps a highlighter across the words, line by line, until a real pointer arrives.
MarkerAnnotations.segmentsMARKER_SEGMENTSMarker Annotations: the paragraph as plain strings with { text, kind, color?, darkColor?, delay? } objects between them. kind is highlight, underline, circle or strike.
MarkerAnnotations.showReplaytrueMarker Annotations: shows the Draw again button under the paragraph.
MarkerAnnotations.replayLabel"Draw again"Marker Annotations: label of the replay button.
MarkerAnnotations.autoplayfalseMarker Annotations: replays the marks every few seconds while on screen, until someone presses a button or touches the text. Never runs under reduced motion.
MarkerAnnotations.className—Marker Annotations: extra classes for the paragraph (size, weight, colour).

Add it to your project

  1. 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 creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 2

    Connect the registry

    Run this once per project. It writes the Nexus UI entry into components.json for 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.

  1. 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/hover-highlight-text
  2. 4

    Check what was added

    With a project made as in the Quick Start (a src/ folder), these files land in it:

    components/
    hover-highlight-text.tsx
    hover-highlight-text/
    hover-highlight-text.tsx
    index.ts
    marker-annotations.tsx
  3. 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:

  4. 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 { HoverHighlightText } from "@/components/hover-highlight-text";
    
    export default function Page() {
      return (
        <main>
          <HoverHighlightText />
        </main>
      );
    }

Like Hover Highlight Text? 256 more are in Pro.

Pro unlocks all 256 Pro components, every template and block, and everything we release next. Hover Highlight Text stays free.

About Hover Highlight Text

Hover Highlight Text renders a cursor-tracked SVG spotlight that reveals outlined text beneath a filled base layer. Two versions of the text are composited — filled on top, outlined beneath — with a circular spotlight clip that tracks the cursor using Framer Motion spring physics. As the mouse moves across the text, the spotlight uncovers the outlined variant below. A cinematic interaction for hero headlines and section callouts that rewards cursor exploration.

Good for

  • Hero heading interactive effects
  • Landing page slogan interactions
  • Section title hover animations
  • Promotional headline effects

Hover Highlight Text questions

Which props control the highlight?

`spotlightRadius` (default 118px) and `spotlightSoftness` set the size and edge, `strokeColor` and `strokeWidth` style the outline, and `springConfig` changes how the spotlight follows the cursor. `enableGlow` adds a faint glow.

Can I use it for an h1?

Yes. Set `as` to "h1", "h2", "p" or "span" (default h2). The outlined copy is aria-hidden, so screen readers read the text once.

Does it work on touch devices?

Yes. Tapping reveals the highlight at the touch point.

What happens with reduced motion?

The spotlight no longer follows the pointer; the outlined layer is shown at low opacity instead.