Skip to main content
The Collaboration extension enables real-time collaborative editing in Tiptap using Yjs. It synchronizes content across multiple users and includes built-in undo/redo functionality that works seamlessly in collaborative environments.
The Collaboration extension comes with its own history implementation and is not compatible with the @tiptap/extension-undo-redo extension. Make sure to remove the UndoRedo extension if you’re using Collaboration.

Installation

You’ll also need a Yjs provider to sync data between clients. Popular options include:

Basic Usage

Configuration Options

Y.Doc
An initialized Y.js document. This is the shared data structure that will be synchronized across all clients.Example:
string
Name of the Y.js fragment to use. You can use different fields to sync multiple editors with one Y.js document.Default: 'default'
XmlFragment
A raw Y.js fragment. Use this instead of document and field if you want direct control over the fragment.
any
The collaboration provider instance (e.g., WebsocketProvider, WebrtcProvider). While not required by the extension itself, storing it here makes it accessible via the extension.Default: null
() => void
Callback fired when the content from Yjs is initially rendered to Tiptap. Useful for showing a loading state until the document is ready.
object
Options passed to the Y.js sync plugin. See y-prosemirror documentation for available options.
object
Options passed to the Y.js undo plugin.

Commands

command
Undo recent changes.Keyboard shortcut: Cmd/Ctrl + Z
command
Reapply reverted changes.Keyboard shortcuts: Cmd/Ctrl + Shift + Z or Cmd/Ctrl + Y

Storage

boolean
Whether collaboration is currently disabled. This is automatically set when collaboration encounters a content error.

Advanced Examples

Complete Collaborative Editor

Multiple Editors with One Document

Loading State

Content Error Handling

Custom Provider Setup

Custom Undo/Redo Tracking

Keyboard Shortcuts

Storage Access

Utilities

The Collaboration extension adds utility methods to the editor:

Source Code

View the source code on GitHub: