Highlighter
ProNewMarker 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
| Prop | Type | Default |
|---|---|---|
| variant | "highlight" | "underline" | "circle"`highlight` wraps across lines; `underline` and `circle` are drawn around a short phrase. | "highlight" |
| color | stringInk color. Any CSS color. | "color-mix(in oklch, var(--brand) 45%, transparent)" |
| delay | numberSeconds to wait after the text scrolls into view. | 0 |
| duration | numberSeconds the stroke takes to draw. | 0.7 |
| className | string | — |
| 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.