Skip to main content

Comments Collection

The Comments module provides room-scoped threaded comments with support for replies, emoji reactions, and user tagging. All changes are synced in real time to other participants. Access it via client.comments.
Editors can create and mutate comments. Viewers receive comment updates, but comment writes, reactions, tags, and replies are blocked for viewer sessions.

Methods

Add Comment

add(text, opts?) Add a top-level comment to the room. Optionally tag users at creation:
The returned comment is a CollabKitCommentInstance with methods for replies, reactions, and tags.

Get Comments

getAll() Fetch all comments in the room:

Sync Comments

sync() Force a full sync of comments from the server:

Delete Comment

delete(commentId) Delete a top-level comment. This cascades and removes all its replies:

Events

Listen for comment changes across the room:

Comment Instance

Each comment returned by add() or getAll() is a CollabKitCommentInstance with its own properties and methods.

Properties

Methods

Reply to Comment

reply(text, opts?) Add a reply to this comment (one level of nesting):

Delete Reply

deleteReply(replyId) Remove a reply:

Add Reaction

addReaction(reaction) Add an emoji reaction to the comment:
Reactions on replies work the same way:

Delete Reaction

deleteReaction(reaction) Remove a reaction:

Add Tag

addTag(userId) Tag a user on this comment:

Delete Tag

deleteTag(userId) Remove a user tag:
Tagged users receive a commentTagged event on their user instance. See User Events.

Events

Listen for updates to a specific comment:

Examples

Threaded Comments