Skip to main content
Configuration is passed when creating a SuperDoc instance. Only two fields are required.

Quick start

Core parameters

string | HTMLElement
required
DOM selector or element where SuperDoc will mount.
Document | string | File
required
Document to load.Can be a Document (Object), string or File
For 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.
Document[]
Multiple documents to load (alternative to single document)
string
Unique identifier for this SuperDoc instance
Auto-generated UUID if not provided

User & permissions

Object
Current user information
User[]
default:"[]"
All users with document access. Used for @mentions and collaboration.
string
default:"'editor'"
User permission level
Role overrides documentMode when more restrictive
string
default:"'editing'"
Initial document mode
See the Track Changes extension for accept/reject commands, and the runnable example for a complete workflow.
Object
Viewing-mode visibility controls for standard comments
Object
Viewing-mode visibility controls for tracked changes
function
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

Object
Configure optional modules

Collaboration module

Object
Real-time collaboration settings
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

Object
Comments system configuration

Toolbar module

Object
Toolbar configuration
Object
deprecated
Deprecated — Use modules.contextMenu instead. See the Context Menu module for configuration options.

Appearance

string
default:"'SuperDoc'"
Document title for exports and display
string[]
Colors for user awareness and highlighting
Built-in palette provided by default
Object
Document view options for controlling layout
Use 'web' for mobile devices and WCAG AA reflow compliance (Success Criterion 1.4.10). When set to 'web', the layout engine is automatically disabled.
string
deprecated
Removed in v1.0 — Use viewOptions.layout instead. 'paginated''print', 'responsive''web'.
Object
deprecated
Removed in v1.0 — Use CSS to control margins in web layout mode.
boolean
default:"false"
Show document rulers
string
CSS selector for the toolbar container (e.g. '#toolbar'). Shorthand for modules.toolbar.selector.

Advanced options

Extension[]
default:"[]"
Additional SuperDoc extensions
function
Custom image upload handler
Object
deprecated
Deprecated since v1.8 — This option is no longer supported and will be ignored.
Object
Override document content with a JSON schema. Used to load documents from a previously exported JSON representation instead of a DOCX file.
string
default:"'Arial, Helvetica, sans-serif'"
Font family used for all SuperDoc UI elements (toolbar, comments, etc.)
boolean
default:"false"
Prevent default DOCX styles from being applied
boolean
default:"false"
Disable custom context menus
function
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.
boolean
default:"false"
Log a console.warn listing HTML elements dropped during import. Ignored when onUnsupportedContent is provided.
string
Content Security Policy nonce

Event handlers

All handlers are optional functions in the configuration:
function
Called when SuperDoc is ready
function
Called before an editor is created
function
Called when editor is created
function
Called on content changes
function
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.
When using a custom handler, you are responsible for calling editor.commands.acceptTrackedChangeById() if you want the change accepted. The default behavior is fully replaced.
function
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.
When using a custom handler, you are responsible for calling editor.commands.rejectTrackedChangeById() if you want the change rejected. The default behavior is fully replaced.
function
Called when the comments sidebar is toggled
function
Called when an error occurs
See Events for complete list.