Skip to main content
Version: 1.0.0

Collaboration

Add commenting, mentions, and role-based permissions so teams can review and discuss designs within the editor.

import { useRef } from "react";
import { DragbleEditor, DragbleEditorRef } from "dragble-react-editor";

function CollaborativeEditor() {
const editorRef = useRef<DragbleEditorRef>(null);

return (
<DragbleEditor
ref={editorRef}
editorKey="db_your_key"
editorMode="email"
options={{
collaboration: {
enabled: true,
role: "editor", // 'editor' | 'reviewer'
user: {
id: "user-42",
name: "Jane Smith",
avatar: "https://cdn.example.com/avatars/jane.jpg",
},
mentions: [
{ id: "user-1", name: "Alice Johnson" },
{ id: "user-2", name: "Bob Chen" },
{ id: "user-3", name: "Carlos Rivera" },
],
},
}}
onComment={async (comment) => {
await fetch("/api/comments", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(comment),
});
}}
/>
);
}

Roles

RoleCan edit contentCan commentCan resolve comments
editorYesYesYes
reviewerNoYesNo

:::tip Reviewer mode Set role: 'reviewer' for stakeholders who need to give feedback but should not modify the design. They can add comments and mentions but cannot drag, edit, or delete content. :::

Mentions

Users type @ in a comment to trigger the mentions dropdown. Provide the mentions array with team members:

mentions: [
{ id: "user-1", name: "Alice Johnson", avatar: "https://..." },
{ id: "user-2", name: "Bob Chen", avatar: "https://..." },
];

:::info Comment data structure The onComment callback receives an object with { id, userId, userName, text, rowId, timestamp, mentions: string[] }. Persist this to your backend and load existing comments via the design JSON. :::

Method reference

MethodReturnsDescription
setCollaboration(config)voidUpdate collaboration settings at runtime
CallbackParametersDescription
onComment(comment: CommentData)Fired when a user posts a comment

Next steps