Quick start
Core parameters
Document to load.Can be a
Document (Object), string or FileFor a
Document object, use data for local files and url for remote files.
Provide one source field (data or url) per document object.
Use documents array for multiple documents instead.User & permissions
Initial document mode
See the Track Changes module for accept/reject commands, the Document API, and configuration. The runnable example shows a complete workflow.
Override permission checks for comments and tracked changes. By default, editors can resolve, edit, and delete any user’s comments and tracked changes. Use this to restrict actions.
Return
false to block an action. Return true or undefined to fall back to the built-in permission matrix. See Comments > Permission resolver for the full list of permission types.Modules
Collaboration module
SuperDoc uses a provider-agnostic collaboration contract:
modules.collaboration = { ydoc, provider }.
Provider setup remains in your app code. See Collaboration configuration and Collaboration guides.Comments module
Track changes module
Track changes configuration. Supersedes the top-level
trackChanges and layoutEngineOptions.trackedChanges keys, which remain supported as deprecated aliases.Toolbar module
Surface defaults
You only need
modules.surfaces if you want shared defaults, a central resolver, or to enable/configure built-in surface behaviors like find/replace and the password prompt. Direct superdoc.openSurface(...) calls do not require any special setup.Content controls module
Use this when you want to keep content controls in the document but disable SuperDoc’s built-in field visuals.Spell check
Provider-based spell check for the layout-engine editor surface. The configuration key isproofing because the provider contract is designed to support spelling, grammar, and style. The current UI renders spelling only.
Bring your own provider. SuperDoc handles the editor UI. Your app controls the spell-check engine or API. See Spell check and Custom spell-check provider.
Spell check runs when the layout engine is active. In
print layout this works out of the box. In web layout, keep the layout engine enabled with layoutEngineOptions.flowMode: 'semantic'.Only spelling issues render in v1. Grammar and style issues can still be returned by your provider but are not shown yet.
Appearance
Document view options for controlling layout
Use
'web' for mobile devices and WCAG AA reflow compliance (Success Criterion 1.4.10). If you also need layout-engine-powered features such as proofing in web layout, set layoutEngineOptions.flowMode: 'semantic'.Enable contained mode for fixed-height container embedding. When
true, SuperDoc fits within its parent’s height and scrolls internally instead of expanding to the document’s natural height. Works with DOCX, PDF, and HTML documents.Use this when embedding SuperDoc inside a panel, sidebar, or any container with a fixed height (e.g., height: 400px or flex: 1).Zoom behavior for the document. Use
mode: 'fit-width' to keep DOCX and PDF documents fitted to the available container width. Calling setZoom() switches back to manual zoom.For custom behavior, listen to viewport-change and call setZoom() yourself.Responsive zoom example
Minimal React example for fit-width zoom with current zoom and viewport metrics.
CSS selector for the built-in toolbar container (e.g.
'#toolbar'). Shorthand for modules.toolbar.selector.Omit this to skip the built-in toolbar: for example, when using the headless toolbar to build your own UI.Advanced options
Override document content with a JSON schema. Used to load documents from a previously exported JSON representation instead of a DOCX file.
Font family used for all SuperDoc UI elements (toolbar, comments, etc.)
Disable custom context menus
Callback invoked with HTML elements that were dropped during import because they have no schema representation. Receives an array of
{ tagName, outerHTML, count } items. When provided, console.warn is suppressed.Log a
console.warn listing HTML elements dropped during import. Ignored when onUnsupportedContent is provided.Event handlers
All handlers are optional functions in the configuration:Called when the fit-width calculation changes. Pixel-level width jitter is deduped.
getViewportMetrics() always reads the latest measurements.Custom handler for accepting tracked changes from comment bubbles. Replaces default accept behavior when provided.
Only fires from bubble buttons, not toolbar or context menu. The dialog cleanup (closing the bubble) happens automatically after your handler runs.
Custom handler for rejecting tracked changes from comment bubbles. Replaces default reject behavior when provided.
Only fires from bubble buttons, not toolbar or context menu. The dialog cleanup (closing the bubble) happens automatically after your handler runs.

