Skip to content
Ballpoint

Annotate

Marks a word or phrase the way you would with a pen: underlined, circled, boxed, struck through, scribbled out, bracketed or shaded in, drawn as it scrolls into view.

Only in Ballpoint

The plan was to ship on Friday. The build failed twice, so we blamed the cache read the logs and found it in ten minutes.

Installation

pnpm dlx shadcn@latest add @ballpoint/annotate

Usage

tsx
import { Annotate } from "@/components/ui/annotate"

<p>
  The build <Annotate type="circle" color="red">failed</Annotate> twice.
</p>

Examples

Seven marks

Underline, circle, box, strike, scribble, bracket and highlight, in the ink or the red pen.

  • underlinea ballpoint
  • circlea ballpoint
  • boxa ballpoint
  • strikea ballpoint
  • scribblea ballpoint
  • bracketa ballpoint
  • highlighta ballpoint

On and off

With active, a mark draws in when it turns true and pulls back out when it turns false.

Buy milk and call the plumber

In running text

Marks mixed through a changelog: a title underline, a highlight, a red strike and a boxed link.

Release notes

This version is twice as fast, and the old config file is gone. Read the migration guide first.

Questions? Ask in the issues.

API reference

type
default "underline"
"underline" | "circle" | "box" | "strike" | "scribble" | "bracket" | "highlight"

The mark. A highlight is shaded in behind the words.

color
default "ink"
"ink" | "red"

The ink, or the red pen corrections are made in.

as
default "span"
"span" | "mark" | "del" | "s" | "ins" | "em" | "strong"

The element: mark for a highlight, del or s for words struck out, so the meaning survives without the drawing.

delay
default 0
number

ms after it scrolls into view before the pen starts. Rising delays draw a run of marks one after another.

active
boolean

Draws the mark while true and pulls it back out when false, instead of drawing it once.

brackets
default "both"
"both" | "left" | "right"

Which brackets a bracket draws.

seed
string | number

Pins the drawing.

Pen settings

The drawing also takes draw, roughness, passes, weight and speed, as props or from the nearest InkProvider. What each one does.