Driving live React UI state? Prefer
superdoc/ui subscriptions. useSuperDocSelection, useSuperDocComments, useSuperDocTrackChanges, useSuperDocDocument, and useSuperDocCommand give you typed, memoized, per-slice state with one re-render per change instead of a manual superdoc.on('editor-update', ...) loop. See Custom UI.The events on this page are for lifecycle (ready, editor-create), integration (error, comment-changed), analytics, and compatibility with code that doesn’t use the React surface.Subscribing to events
Lifecycle events
ready
Fired when SuperDoc is fully initialized.
editorBeforeCreate
Fired before an editor is created. Use this to configure extensions or set up services.
editorCreate
When an editor is created.
editorDestroy
When an editor is destroyed.
Content events
editor-update
When editor content changes. Use this to refresh live UI state like word counts or auto-save.
editor.doc.info() inside the handler to build a live document-stats panel without polling.
content-error
When content processing fails.
fonts-resolved
When document fonts are resolved.
Content controls (SDT fields)
content-control:active-change
Fires when selection enters a content control, switches between controls, or leaves all controls.
SdtRef shape:
active is the deepest control (activePath[0]); activePath holds the full stack, innermost first. Controls without an id do not emit these events.
How to interpret:
- Focus (
null -> A):previous === null && active !== null - Switch (
A -> B):previous !== null && active !== null && previous.id !== active.id - Blur (
A -> null):previous !== null && active === null
content-control:click
Fires on pointer click inside a content control.
onContentControlActiveChange and onContentControlClick.
To build your own content-control UI on these events, see Custom UI > Content controls.
Comments events
comments-update
When comments are modified.
Collaboration events
collaboration-ready
When collaboration is initialized.
awareness-update
When user presence changes.
locked
When document lock state changes.
Pagination events
pagination-update
Fired after each layout pass with the current page count. Use this to know when page data is available: activeEditor.currentTotalPages is only populated after the first layout completes, which happens after the ready event.
UI events
zoomChange
When the zoom level changes, from any source: setZoom(), the toolbar zoom control, or fit-width mode. The payload carries the value and the mode that produced it. Also available as the onZoomChange config callback.
viewport-change
When the fit-width calculation changes. Pixel-level width changes that do not affect the rounded fit are deduped. getViewportMetrics() always reads the latest measurements.
availableWidth- container width in pixels, minus the comments sidebar when visibledocumentWidth- the widest document page width in pixels at 100% zoom (zoom-independent; DOCX from laid-out pages with page-styles fallback, PDF from rendered pages)fitZoom- the unclamped zoom percentage that fits the page into the available width
zoom.mode: 'fit-width'. Subscribe to this event only when you want to apply custom zoom behavior.
sidebar-toggle
When the comments sidebar is toggled.
Error events
exception
When an error occurs during document processing or runtime.
Configuration-based events
Events can also be set during initialization:Event order
editorBeforeCreate: Before editor mountseditorCreate: Editor readyready: All editors readycollaboration-ready: If collaboration enabledpagination-update: After each layout pass (page count available)- Runtime events (
editor-update,comments-update,sidebar-toggle, etc.) editorDestroy: Cleanup

