---
title: "Configuring the Comments plugin access option"
description: "TinyMCE Comments plugin access options."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/comments-access-options/"
md_url: "https://www.tiny.cloud/docs/tinymce/latest/comments-access-options/index.md"
version: "latest"
last_updated: "2026-06-15T05:48:02Z"
tokens: 1031
---
# Configuring the Comments plugin access option

## Access Options

The following configuration option affects the behavior of the Comments plugin.

### `tinycomments_access`

**Type:** `String`

**Possible values:** `'comment'`

This option sets the editor to the readonly mode, while still allowing comments to be made.

> **Important:**
> - When `tinycomments_access` is set to `comment`, the editor will automatically switch to [Readonly Mode](../editor-important-options/#readonly).

#### Comments with `tinycomments_access` set to `'comment'`

When `tinycomments_access` is set to `comment`, the editor will be in [Readonly mode](../editor-important-options/#readonly), but the comments will be in a **comment-only** mode. This means that users can add and delete comments, but they cannot edit the editor content.

Example
```javascript
tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'tinycomments',
  tinycomments_mode: 'embedded',
  toolbar: 'addcomment showcomments',
  tinycomments_access: 'comment'
});
```
**Example**

```js
tinymce.init({
  selector: "textarea#comments-ui-mode",
  plugins: [
    "tinycomments", "advlist", "anchor", "autolink", "charmap", "code", "fullscreen",
    "help", "image", "insertdatetime", "link", "lists", "media",
    "preview", "searchreplace", "table", "visualblocks", "quickbars", 'quickbars', 'image',
  ],
  toolbar: "addcomment showcomments | undo redo | styles | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
  quickbars_selection_toolbar: 'alignleft aligncenter alignright | addcomment showcomments',
  quickbars_image_toolbar: 'alignleft aligncenter alignright | rotateleft rotateright | imageoptions',
  tinycomments_mode: 'embedded',
  tinycomments_access: 'comment',
  sidebar_show: 'showcomments'
});
```

#### Comments with `readonly` set to `true`

When not using the `tinycomments_access` option, the comments sidebar will have a different state depending on the use of the [`readonly` option](../editor-important-options/#readonly).

With neither [Readonly mode](../editor-important-options/#readonly) nor `tinycomments: "comment"` configured, both the editor and the comments sidebar will be in their default state. By default, comments can be both viewed and added, and the editor content is editable.

With [Readonly mode](../editor-important-options/#readonly) enabled, the comments sidebar will be in a **view-only** mode, meaning all comments can be viewed and navigated, but no new comments can be added. Also, in the **readonly** state, the editor will still not be editable.

Example
```javascript
tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'tinycomments',
  tinycomments_mode: 'embedded',
  toolbar: 'addcomment showcomments',
  readonly: true, // set the editor to read-only mode
});
```
**Example**

```js
tinymce.init({
  selector: "textarea#comment-readonly-ui-mode",
  plugins: [
    "tinycomments", "advlist", "anchor", "autolink", "charmap", "code", "fullscreen",
    "help", "image", "insertdatetime", "link", "lists", "media",
    "preview", "searchreplace", "table", "visualblocks", "quickbars",
  ],
  toolbar: "addcomment showcomments togglereadonly | undo redo | styles | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
  quickbars_selection_toolbar: 'alignleft aligncenter alignright | addcomment showcomments',
  quickbars_image_toolbar: 'alignleft aligncenter alignright | rotateleft rotateright | imageoptions',
  tinycomments_mode: 'embedded',
  sidebar_show: 'showcomments',
  readonly: true,
  setup: (editor) => {
    const isReadonlyMode = () => editor.mode.get() === 'readonly';
    editor.ui.registry.addToggleButton('togglereadonly', {
      text: 'Readonly mode',
      context: 'any', // Available from 7.4
      onSetup: (buttonApi) => {
        const activate = (api) =>  () => api.setActive(isReadonlyMode());
        editor.on('SwitchMode', activate(buttonApi));
        return (teardownApi) => editor.off('SwitchMode', activate(teardownApi));
      },
      onAction: (api) => {
        editor.mode.set(isReadonlyMode() ? 'design' : 'readonly');
      }
    });
  }
});
```
