Components / Text
Highlighter
Marks text with a marker, underline or hand-drawn circle that draws itself as it scrolls into view.
Ship beautiful interfaces without the busywork.
Installation
Requires React 18+ and Tailwind CSS.
- 1
Install dependencies
$ npm install motion - 2
Add the component
Copy the code from the Code tab above into
components/ui/highlighter.tsx. - 3
Use it
example.tsximport { Highlighter } from "@/components/ui/highlighter"; export default function HighlighterDemo() { return ( <p className="max-w-md text-center text-2xl font-medium leading-relaxed text-zinc-800 dark:text-zinc-200"> Ship <Highlighter>beautiful</Highlighter> interfaces{" "} <Highlighter variant="underline" delay={0.8}> without </Highlighter>{" "} the{" "} <Highlighter variant="circle" delay={1.4}> busywork </Highlighter> . </p> ); }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "marker" | "underline" | "circle" | "marker" | Style of the mark. |
| delay | number | 0.2 | Seconds after entering the viewport. |
| colorClassName | string | — | Mark color, e.g. "bg-sky-300/60" or "stroke-sky-500" (circle). |