# createCollaboration (@salmonui/rich-text/collab)

> The createCollaboration function of @salmonui/rich-text/collab: The collaboration extension: pass it in extensions (keep it stable, for example in useMemo per doc). It binds the editor to the Y.Doc (ySyncPlugin), shows remote cursors (yCursorPlugin, when awareness is given) and replaces the engine history with the per-user Yjs undo manager (yUndoPlugin): undo and redo, their keys and the toolbar buttons revert only the local user's changes. The Y.Doc is the source of truth, so do not drive a collaborative editor with a controlled value.

Canonical: https://salmonui.dev/docs/reference/rich-text/collab/createCollaboration

```ts
import { createCollaboration } from '@salmonui/rich-text/collab';
```

Entry index: https://salmonui.dev/docs/reference/rich-text/collab (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/rich-text/collab.md).

## Reference

Kind: function

```ts
function createCollaboration(options: CollaborationOptions): RichTextExtension;
```

The collaboration extension: pass it in `extensions` (keep it
stable, for example in `useMemo` per doc). It binds the editor to the Y.Doc
(`ySyncPlugin`), shows remote cursors (`yCursorPlugin`, when `awareness` is
given) and replaces the engine history with the per-user Yjs undo manager
(`yUndoPlugin`): undo and redo, their keys and the toolbar buttons revert
only the local user's changes. The Y.Doc is the source of truth, so do not
drive a collaborative editor with a controlled `value`.
