Skip to main content
Add Word-style commenting to documents with threaded discussions, replies, and resolution workflows.
Building your own comments sidebar in React? Skip this module and read Custom UI › Comments instead. It documents useSuperDocComments, ui.selection.capture(), and the typed posting flow.

Quick start

The comments module is enabled by default. To disable it entirely, set modules.comments to false:

Configuration

boolean
default:"false"
View-only mode. Hides the reply input and the edit action on existing comments. Users can still read comments and threads but cannot add, edit, or reply.
boolean
default:"true"
Allow marking comments as resolved
string | HTMLElement
Container for comments sidebar
boolean
default:"false"
Enable dual internal/external comment system
boolean
default:"false"
Hide internal comments from view
boolean
default:"false"
Show resolved comments in the comments list
function
Comments-only override for permission checks. See Permission Resolver.
Object
Custom colors for comment highlights.
Object
Opacity values for comment highlights (0–1).
string
Hover highlight color for comment marks
Object
Colors for tracked change highlights.
Object
Colors for the active tracked change highlight. Same properties as trackChangeHighlightColors. Defaults to trackChangeHighlightColors values when not set.

Small-screen behavior

Use displayMode to control how comment/tracked-change bubbles render when container width is constrained.
'sidebar' | 'inline' | 'auto'
default:"'sidebar'"
Display policy for comment and tracked-change bubbles.
  • 'sidebar': always render right sidebar bubbles.
  • 'inline': always render compact inline popover mode.
  • 'auto': switch between sidebar and inline mode based on measured available width.
number
Optional fixed compact threshold (px) for displayMode: 'auto'. If set, inline mode activates when available width is below this value.
string
Optional CSS selector for the width measurement target in displayMode: 'auto'. Useful for custom flex/grid host shells where the default measurement target is not representative.

Viewing mode visibility

Comments are hidden by default when documentMode is viewing. Use comments.visible and modules.trackChanges.visible to control what renders in read-only mode.
The top-level trackChanges key still works as a deprecated alias for modules.trackChanges and will emit a one-time console warning.

Setting up the comments UI

During initialization:
After initialization:

Permission resolver

Customize who can resolve comments or accept tracked changes. The resolver receives the permission type, current user, and any tracked-change metadata. Return false to block the action. By default, editors can resolve, edit, and delete any user’s comments and tracked changes: regardless of authorship. Use permissionResolver to restrict actions when needed.
Available permission types:
You can set a global resolver with the top-level permissionResolver config. Module-level resolvers take precedence when both are defined.

Word import/export

Word comments are automatically imported with the document and marked with importedId. When exporting, use the commentsType option:

API methods

For new code, prefer the typed paths. Use editor.doc.comments.* for document mutations (server-and-client compatible, returns receipts) or ui.comments.* for React UI work (createFromSelection, createFromCapture, reply, resolve, reopen, delete). The chain commands below are kept for backwards compatibility and for code already written against superdoc.activeEditor.commands.*. See Document API › Comments and Custom UI › Comments.
These methods are available on the active editor’s commands:

addComment

Add a comment to the current text selection. Requires a text selection.
string | Object
Comment content as a string, or an options object with:

addCommentReply

Add a reply to an existing comment or tracked change.
Object
required

removeComment

setActiveComment

Highlight and focus a comment.

resolveComment

setCommentInternal

Toggle a comment between internal and external visibility.

setCursorById

Navigate the cursor to a comment’s position in the document.

scrollToComment

Scroll the document to a comment and set it as active. Unlike setCursorById, this is a top-level SuperDoc method that works without accessing the editor directly.
See SuperDoc Methods for full parameter documentation.

Events

onCommentsUpdate

Fired for all comment changes.
string
required
Event type: pending, add, update, deleted, resolved, selected, change-accepted, or change-rejected
Comment
required
The Comment object
Object
Additional metadata

Comment data structure

Object

Full example

Comments Example

Runnable example: threaded comments with resolve workflow and event log