Skip to content
Design System
GitHub

Text whose words point at places on a picture, as a vision-language model answers: a span highlights its boxes, a mark its words; `fromGrounding` reads a model's offsets and coordinates.

API reference

Generated from the types. Every part also takes className.

GroundedTextBody

textrequired
stringThe answer or caption. Line breaks are kept.
spansrequired
GroundedSpan[]
annotationsrequired
readonly Pick<Annotation, "id" | "shape">[]The marks the spans point at: the list given to the annotated-image (only each one's id and shape are read).
activeMark
string | null = nullThe mark under the pointer or keyboard on the picture (its onActiveChange): the spans that point at it light up.
onActiveChange
(span: number | null) => voidThe span under the mouse, or else the one with keyboard focus (its index in spans); null when neither. Touch does not hover: a tap pins. Give it to groundedImageProps as activeSpan.
defaultPinned
{ span: number } | { mark: string } | null = nullPinned at first (uncontrolled), or controlled with onPinnedChange. Control it when the picture is elsewhere, so a pinned mark lights its spans.
pinned
{ span: number } | { mark: string } | null
onPinnedChange
(pin: GroundedPin | null) => void
picture
RefObject<Element | null>The element around the linked annotated-image: pinning a span scrolls its marks into view there when they are scrolled out.
labels
Partial<GroundedTextLabels>

GroundedText

textrequired
stringThe answer or caption. Line breaks are kept.
spansrequired
GroundedSpan[]
annotationsrequired
Annotation[]The marks the spans point at (points, boxes or any shape), in the picture's pixels. fromGrounding builds both.
src
stringThe picture, as in annotated-image: src or image, its natural width and height, and what it is in label.
image
ReactNode
widthrequired
number
heightrequired
number
labelrequired
string
showLabels
"none" | "all" | "selected" = "none"Class words on the picture. None by default: the text says what each mark is; "selected" shows the highlighted ones.
legend
boolean = falseannotated-image's line-style legend, for the kinds present. Off by default: a model's answer has one kind.
overlays
AnnotationOverlay[]
loading
boolean
defaultPinned
{ span: number } | { mark: string } | null = nullPinned at first (uncontrolled), or controlled with onPinnedChange.
pinned
{ span: number } | { mark: string } | null
onPinnedChange
(pin: GroundedPin | null) => void
labels
Partial<GroundedTextLabels>
imageLabels
Partial<AnnotatedImageLabels>annotated-image's words (annotatedImageLabels in labels-zh-tw).