Components / effect

Highlight Draw

v1.0.0 · premium

A marker highlight that sweeps behind a phrase when it scrolls into view, following the line breaks.

Highlight Draw demo

Implementation

A marker highlight that sweeps behind a phrase when it scrolls into view, following the line breaks.

Framework
React 19.3.1 with TypeScript
Motion
Native CSS and browser APIs. No GSAP required.
Available modes
build
Version
1.0.0 · published

Source code

Download source ZIP
export function HighlightDraw({ children, mark, duration = 1000, delay = 0, className }: {
  children: ReactNode;
  /** Highlight color. */

Quality evidence

Export tested in 2 consumer projects with chromium, firefox, webkit. Evidence recorded on .

Changelog

v1.0.0 · A marker highlight that sweeps behind a phrase when it scrolls into view, following the line breaks.

Frequently asked questions

Does the highlight follow line breaks?

Yes. It is a background on an inline span with box-decoration-break clone, so it wraps with the phrase.

What about contrast?

The text keeps its normal color, so choose a highlight color that keeps enough contrast with it. In forced-colors mode the highlight becomes an underline.