Skip to content
Design System
GitHub

Annotated image

v0.18.0Beta

Boxes, points, polygons and poses over a picture, in its own pixel space: predicted solid, ground truth dashed, the previous version dotted, each on a halo; class words, a line-style legend, selection by keyboard, raster overlays, loading and failed states.

API reference

Generated from the types. Every part also takes className.

AnnotatedImage

src
stringThe picture. Or pass image to draw your own (a canvas, a video frame).
image
ReactNodeThe picture as an element, in place of src; it should fill its box (size-full).
widthrequired
numberThe picture's natural size in pixels: the coordinate space of the annotations, and the box's aspect ratio.
heightrequired
number
labelrequired
stringWhat the picture is, e.g. "Camera 2, aisle 3, 14:08". The annotations are summarised after it for screen readers.
annotationsrequired
Annotation[]
selectedId
string = nullThe annotation drawn as selected: 3 px in the focus ink, with handles.
onSelectedChange
(id: string | null) => voidMakes each annotation a button (one Tab stop, arrows move, Enter selects, Esc clears). Without it nothing is focusable.
showLabels
"none" | "all" | "selected" = "all"Which class words show on the picture. selected keeps a crowded picture readable; the words are still read out.
legend
boolean = trueThe line-style legend under the picture, for the kinds present. On by default; off when the page has its own.
overlays
AnnotationOverlay[] = []Raster layers drawn between the picture and the marks, in order.
loading
booleanShow the box at the picture's aspect ratio, breathing, until the picture and its annotations arrive.
labels
Partial<AnnotatedImageLabels>

AnnotationLegend

kinds
AnnotationKind[] = kindsThe kinds to list, in this order: predicted, ground truth, previous version.
labels
Partial<Pick<AnnotatedImageLabels, "legend" | "previous" | "predicted" | "truth">>