RoughAnnotation

Hand-drawn underlines, circles, boxes, and highlights that draw in.

Source

Every mark type

Set type to one of seven hand-drawn marks.

underline
Insights
box
Insights
circle
Insights
highlight
Insights
strike-through
Insights
crossed-off
Insights
bracket
Insights

Highlight across lines

Set multiline to draw one mark for each line of wrapped text.

"We replaced four tools with PostHog. Now every team looks at the same numbers, from the same events, in the same place."

Stroke, passes, and padding

Tune the line weight, the number of pen passes, and the space around the text.

strokeWidth={1}
Session replay
strokeWidth={4}
Session replay
iterations={1}
Session replay
iterations={3}
Session replay
padding={[4, 12]}
Session replay

A sequence with delays

Set delay in milliseconds to draw marks one after another.

Capture, analyze, and ship.

Controlled

Set show to draw or remove the mark from state. onComplete runs when the draw ends.

Flags let you roll out to 5% of users first.

Not drawn

Usage

These are defaults, not laws. Break one when you have a good reason, or when it makes the design more cohesive or more interesting.

  • Pass a brand color name. Lines use the full color. The highlight type uses a see-through tint of it, so the text stays readable. Gray follows the text color.
  • The mark is decorative and screen readers skip it. Do not use it to carry meaning.

API

RoughAnnotation is a copy of components/Code/RoughAnnotation. It draws with the rough-notation library.

RoughAnnotation

PropTypeDefaultDescription
type'underline' | 'box' | 'circle' | 'highlight' | 'strike-through' | 'crossed-off' | 'bracket'–The mark to draw.
color'gray' | 'brand' | 'blue' | 'cobalt' | 'coral' | 'corn-blue' | 'green' | 'lemon' | 'lime' | 'purple' | 'tangerine' | 'teal' | 'violet' | 'yellow''gray'A brand color for the mark. Gray uses the text color.
strokeWidthnumber2The line weight in pixels.
animationDurationnumber800The draw time in milliseconds.
paddingnumber | [number, number] | [number, number, number, number]0Space between the text and the mark, in pixels.
animateOnScrollbooleantrueDraws the mark when the text scrolls into view.
delaynumber0Wait time before the draw, in milliseconds.
showboolean–Shows or hides the mark from state.
brackets('left' | 'right' | 'top' | 'bottom')[]–The sides that get a bracket when type is bracket.
iterationsnumber2Pen passes. More passes look rougher.
multilinebooleanfalseDraws one mark for each line.
classNamestring–Classes for the wrapper span.
onComplete() => void–Runs when the draw ends.