---
title: "Review documents with comments in Document Authoring"
canonical_url: "https://www.nutrient.io/guides/document-authoring/review-and-collaboration/comments-and-review-workflows/"
md_url: "https://www.nutrient.io/guides/document-authoring/review-and-collaboration/comments-and-review-workflows.md"
last_updated: "2026-07-01T00:00:00.000Z"
description: "Learn how to use comments in Document Authoring review workflows, including setting the author name, adding comments to selected text, replying in threads, and resolving discussions."
---

# Review documents with comments

Before you start, ensure the Document Authoring library is installed and running. Refer to the [getting started](https://www.nutrient.io/sdk/document-authoring/getting-started.md) guide.

Document Authoring includes built-in comment workflows for review. Comments anchor to document text and appear beside the document. Reviewers can add comments from the **Insert** menu or context menu, reply in threads, edit comment text, resolve discussions, reopen resolved threads, and delete comments when they’re no longer needed.

The example code omits error handling. Add it before using this code in production.

## Set the author when creating the editor

Use [`UIOptions.author`](https://www.nutrient.io/api/document-authoring/types/uioptions/#author) to set the author name used for new comments, replies, and tracked changes:

```js

const editor = await docAuthSystem.createEditor(
  document.getElementById('editor'),
  {
    ui: {
      author: 'Jane Reviewer',
    },
  },
);

```

If you don’t provide an author name, comments use a localized anonymous label.

## Change the author at runtime

Use [`editor.setAuthor(name)`](https://www.nutrient.io/api/document-authoring/types/docautheditor/#setauthor) to update the current author when the active user changes:

```js

editor.setAuthor('Legal Team');

```

Read the current author with [`editor.getAuthor()`](https://www.nutrient.io/api/document-authoring/types/docautheditor/#getauthor):

```js

const currentAuthor = editor.getAuthor();
console.log(currentAuthor);

```

Clear the current author to fall back to the anonymous label:

```js

editor.setAuthor('');

```

## Add comments in the editor UI

To add a comment in the editor:

1. Select the text to review.

2. In the toolbar’s **Insert** menu, select **Comment** — or right-click the selection and choose **Insert → Comment**. (Both options are available only when text is selected.)

3. Enter the comment text.

The comment attaches to the selected text and appears in the document’s comment thread list.

## Reply to and manage comment threads

Document Authoring supports threaded comment discussions. Reviewers can:

- Reply to an existing comment thread

- Edit comment or reply text

- Resolve a thread when the discussion is complete

- Reopen a resolved thread if more review is needed

- Delete a comment thread

This keeps document discussions anchored to the exact text under review.

## Use comments as an AI audit trail

Document Authoring AI can ask the editor to create review comments when it applies agentic write tool calls. Use this when you want AI-generated edits to include reviewer-facing explanations, such as why a clause was changed or which style rule triggered a rewrite.

Review comments created by Document Authoring AI are ordinary comment threads anchored to the changed text, so reviewers can reply, resolve, reopen, or delete them in the same UI described above. Your app still controls the policy: Enable comment creation with the AI toolkit’s `reviewComments: "create"` option, and use Review mode when you also want the edit itself recorded as a tracked change.

For the AI-specific setup, refer to the [agentic tools](https://www.nutrient.io/guides/document-authoring/ai/agentic-tools.md) and [review and approval](https://www.nutrient.io/guides/document-authoring/ai/review-and-approval.md) guides.

## Use comments together with programmatic review flows

Use the programmatic document API inside a transaction to inspect or manage comment threads in code. For example, query open threads with `draft.commentThreads()`, add replies, or resolve threads programmatically:

```js

const currentDoc = editor.currentDocument();

await currentDoc.transaction(async ({ draft }) => {
  const openThreads = draft.commentThreads().all({ status: 'open' });

  for (const thread of openThreads) {
    thread.reply('Reviewed by automation.');
    thread.resolve();
  }

  return true;
});

```

For a full walkthrough of the transaction API, refer to the [programmatic editing](https://www.nutrient.io/guides/document-authoring/editing-content/programmatic-editing.md) guide.

## Learn more

- [Document Authoring API reference](https://www.nutrient.io/api/document-authoring/)

- [Programmatic editing](https://www.nutrient.io/guides/document-authoring/editing-content/programmatic-editing.md)
---

## Related pages

- [Use tracked changes and editor modes](/guides/document-authoring/review-and-collaboration/tracked-changes-and-editor-modes.md)
- [Manage comments and review edits from code](/guides/document-authoring/review-and-collaboration/programmatic-comments.md)

