NPM Package/docs/components/measurement/delete
Delete Annotations
Delete annotations and measurements in Canvas using the SDK.
Use viewer.annotations.delete(...) to delete an annotation or measurement in Canvas.
Delete commands are available after the viewer is mounted, Canvas is ready, and a document is open.
typescript
Overview
Delete target elements using guid or uniqueId:
- For delete, the SDK sends
uniqueId ?? guidto Canvas. If both are provided,uniqueIdtakes priority.
typescript
Selectors
A common flow is to track selection updates and delete the active annotation:
typescript
Select Then Delete
Delete calls are fire-and-forget, but you can listen for confirmation events emitted by Canvas:
typescript
Confirmation Events
Complete integration code setup for Vanilla HTML/JS environments:
Vanilla Example
Complete React Component implementation details:
tsx
React Integration
Broker message mapping for delete APIs:
viewer.annotations.delete(...)maps todeleteAnnotation.viewer.annotations.on("deleted", ...)listens toannotationDeleted.
