Skip to main content

Documentation Index

Fetch the complete documentation index at: https://superdoc-nick-sd-2070-add-content-controls-namespace-to-doc.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Methods are functions you call on the SuperDoc instance to perform actions.

Document operations

export

Export the document with various options.
options
Object
Export configuration
Returns: Promise<Blob> - Document blob
const blob = await superdoc.export({
  isFinalDoc: true,
  commentsType: 'clean',
});

save

Save document if in collaboration mode. Returns: Promise<void>
await superdoc.save();

getHTML

Get HTML content of all editors.
options
Object
HTML options
Returns: string[] - Array of HTML strings, one per editor
const htmlArray = superdoc.getHTML();

Mode control

setDocumentMode

Change the document mode.
mode
string
required
New document mode
superdoc.setDocumentMode('suggesting');

lockSuperdoc

Lock or unlock the document.
isLocked
boolean
required
Lock state
lockedBy
User
User who locked the document
superdoc.lockSuperdoc(true, currentUser);

setHighContrastMode

Enable/disable high contrast mode.
enabled
boolean
required
High contrast state
superdoc.setHighContrastMode(true);

UI methods

setActiveEditor

Set which editor is currently active. Useful when working with multiple documents.
editor
Editor
required
Editor instance to set as active
superdoc.setActiveEditor(editor);

setDisableContextMenu

Toggle the custom context menu at runtime.
disabled
boolean
default:"true"
Whether to disable the context menu
superdoc.setDisableContextMenu(true);

setTrackedChangesPreferences

Override how tracked changes are rendered in the layout engine.
preferences
Object
superdoc.setTrackedChangesPreferences({ mode: 'final' });

toggleRuler

Toggle ruler visibility.
superdoc.toggleRuler();
togglePagination
string
deprecated
Removed in v1.0 — Pagination is now handled by the layout engine. Use viewOptions.layout in configuration instead.

getZoom

Get the current zoom level as a percentage. Returns: number - Current zoom level (e.g., 100, 150, 200). Defaults to 100.
const zoom = superdoc.getZoom();

setZoom

Set the zoom level for all documents. Propagates to all presentation editors, PDF viewers, and whiteboard layers.
percent
number
required
Zoom level as a percentage (e.g., 100, 150, 200). Must be a positive finite number.
superdoc.setZoom(150);

focus

Focus the active editor or first available.
superdoc.focus();

Search methods

Search for text or regex in active editor.
query
string | RegExp
required
Search query
Returns: Array<SearchResult> - Search matches
const results = superdoc.search('contract');
const regexResults = superdoc.search(/section \d+/gi);

goToSearchResult

Navigate to a search result.
match
SearchResult
required
Search result to navigate to
superdoc.goToSearchResult(results[0]);

Comments methods

addCommentsList

Add a comments list to the specified element.
element
string | HTMLElement
required
Container for comments list
superdoc.addCommentsList('#comments-sidebar');

removeCommentsList

Remove the comments list.
superdoc.removeCommentsList();

User management

addSharedUser

Add a user to the shared users list.
user
User
required
User to add
superdoc.addSharedUser({
  name: 'Jane Smith',
  email: 'jane@example.com',
});

removeSharedUser

Remove a user from shared users.
email
string
required
Email of user to remove
superdoc.removeSharedUser('jane@example.com');

Lifecycle

destroy

Completely destroy the SuperDoc instance.
This is irreversible. Cleans up all resources, events, and DOM.
superdoc.destroy();

Event methods

on

Subscribe to an event.
superdoc.on('ready', ({ superdoc }) => {
  console.log('SuperDoc ready');
});

once

Subscribe to an event once.
superdoc.once('ready', () => {
  // Only called once
});

off

Unsubscribe from an event.
superdoc.off('ready', handler);

Schema introspection

getSchemaIntrospection

Returns a JSON schema summary with all nodes, marks, and their attributes. Useful for AI agents that need schema context.
import { getSchemaIntrospection } from 'superdoc';

const schema = await getSchemaIntrospection({ mode: 'docx' });
// Returns: { version, nodes: [...], marks: [...] }
options
Object

TypeScript types

SuperDoc exports TypeScript interfaces for all node and mark types:
import type { NodeName, NodeAttrs, ParagraphAttrs } from 'superdoc/types';

// NodeName shows all 39 node types in autocomplete
type Test = NodeAttrs<'paragraph'>; // Resolves to ParagraphAttrs
Available types: NodeName, NodeAttrs<N>, MarkName, MarkAttrs<M>, and specific interfaces like ParagraphAttrs, TableAttrs, ImageAttrs, etc.

Properties

activeEditor

Currently active editor instance. Returns null before the ready event.
if (superdoc.activeEditor) {
  superdoc.activeEditor.commands.toggleBold();
}
Always check for null before accessing.
PropertyTypeDescription
superdocIdstringUnique identifier for this instance
versionstringSuperDoc version number
activeEditorEditor | nullCurrently active editor
elementHTMLElement | nullContainer DOM element
state{ documents, users }Current state snapshot
isLockedbooleanWhether the document is locked
lockedByUser | nullUser who locked the document
isCollaborativebooleanWhether collaboration is enabled
userUserCurrent user information
usersUser[]All users with document access
toolbarToolbar | nullToolbar instance if configured