Skip to content
API reference

enhance/sketch

Import
import * as api from "@fungi.computer/caps/enhance/sketch";
Kind Export Description
function sketch() The opt-in pencil layer for server-rendered field-guide pages.
Signature
function sketch(root?): () => void;

The opt-in pencil layer for server-rendered field-guide pages.

Markup contract, all plain attributes so any host can use it without React:

  • data-sketch-root marks a positioned host; its overlay is drawn inside it.
  • data-sketch="circle" | "underline" marks inline text to annotate.
  • data-sketch-leader-x / data-sketch-leader-y (fractions of the target box) on a note draw a leader from the note to the data-sketch-target inside the same data-sketch-item. The layout decides whether leaders apply by setting --caps-sketch-leader: on on the note.

Strokes use currentColor, so a theme switch recolors them without a redraw. The host receives data-sketch-drawn once annotations exist, which lets Caps hide the static CSS fallbacks they replace.

Parameter Type Default value
root ParentNode document

() => void