Tags
3/27/26Less than 1 minute
Tags
Renderer Responsibility
Tag visibility is controlled at the annotation renderer level. Each renderer is responsible for determining whether to display tags for its annotations.
Tag Label Function
To display tags, you must set a tag label function using .setTagLabelFn():
createAnnotatedText(id)
.setTagLabelFn((annotation) => annotation.label ?? 'No label')Behavior:
- If no
.setTagLabelFn()is configured, no tags will be displayed - The function receives an annotation and must return:
- A string to display that text as the tag label
nullorundefinedto hide the tag for that annotation
Examples
// Show annotation label or fallback text
.setTagLabelFn((annotation) => annotation.label ?? 'No label')
// Show only annotations with labels
.setTagLabelFn((annotation) => annotation.label ?? null)
// Conditional display
.setTagLabelFn((annotation) =>
annotation.confidence > 0.8 ? annotation.label : null
)Future Enhancement
In a later phase, custom tag rendering will be supported, allowing you to provide your own rendering logic for tag display.