Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Highlighter

ProNew

Marker ink that draws itself on scroll: a multi-line highlight, a hand-drawn underline or a circle.

Installation

pnpm dlx shadcn@latest add @viewport/highlighter

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
variant"highlight" | "underline" | "circle"

`highlight` wraps across lines; `underline` and `circle` are drawn around a short phrase.

"highlight"
colorstring

Ink color. Any CSS color.

"color-mix(in oklch, var(--brand) 45%, transparent)"
delaynumber

Seconds to wait after the text scrolls into view.

0
durationnumber

Seconds the stroke takes to draw.

0.7
classNamestring—
children*React.ReactNode—

Accessibility

  • Uses the mark element, so the emphasis is semantic.
  • The highlight follows wrapped lines at every width.
  • Drawn immediately under reduced motion.