---
title: "Collaboration extension"
description: "Learn how to set up and use collaborative editing with the Collaboration extension in Tiptap."
canonical_url: "https://tiptap.dev/docs/editor/extensions/functionality/collaboration"
---

# Collaboration extension

Learn how to set up and use collaborative editing with the Collaboration extension in Tiptap.

This small guide quickly shows how to integrate basic collaboration functionality into your editor. For a proper collaboration integration, review the documentation of [Tiptap Collaboration](https://tiptap.dev/docs/collaboration/getting-started/overview.md), which is a cloud and on-premises collaboration server solution.

> **Interactive demo:** [CollaborationSplitPane](https://embed.tiptap.dev/preview/Demos/CollaborationSplitPane)

## Install

> **More details:**
>
> For more detailed information on how to integrate, install, and configure the Collaboration
> extension with the Tiptap Collaboration product, please visit our [feature
> page](https://tiptap.dev/docs/collaboration/getting-started/overview.md).

```bash
npm install @tiptap/extension-collaboration @tiptap/y-tiptap yjs y-websocket
```

## Settings

### document

An initialized Y.js document.

Default: `null`

```js
Collaboration.configure({
  document: new Y.Doc(),
})
```

### field

Name of a Y.js fragment, can be changed to sync multiple fields with one Y.js document.

Default: `'default'`

```js
Collaboration.configure({
  document: new Y.Doc(),
  field: 'title',
})
```

### fragment

A raw Y.js fragment, can be used instead of `document` and `field`.

Default: `null`

```js
Collaboration.configure({
  fragment: new Y.Doc().getXmlFragment('body'),
})
```

## Commands

The `Collaboration` extension comes with its own history extension. Make sure to disable the `UndoRedo` extension, if you’re working with the `StarterKit`.

### undo()

Undo the last change.

```js
editor.commands.undo()
```

### redo()

Redo the last change.

```js
editor.commands.redo()
```

## Keyboard shortcuts

| Command | Windows/Linux                      | macOS                      |
| ------- | ---------------------------------- | -------------------------- |
| undo()  | Control + Z                        | Cmd + Z                    |
| redo()  | Shift + Control + Z or Control + Y | Shift + Cmd + Z or Cmd + Y |

## Usage with UniqueID

If you are using the [UniqueID extension](https://tiptap.dev/docs/editor/extensions/functionality/uniqueid.md) together with Collaboration, make sure to mount the editor only after the collaboration provider has synced. Incorrect initialization order can cause persistent empty paragraphs in the document. See [UniqueID: Usage with Collaboration](https://tiptap.dev/docs/editor/extensions/functionality/uniqueid.md#usage-with-collaboration) for details.

## Source code

[packages/extension-collaboration/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-collaboration/)

## You Did It!

Your editor is now collaborative! Invite your friends and start typing together 🙌🏻 If you want to continue building out your collaborative editing features, make sure to check out the [Tiptap Collaboration Docs](https://tiptap.dev/docs/collaboration/getting-started/overview.md) for a fully hosted on on-premises collaboration server solution.

Collaboration

Fasten your seatbelts! Make your rich text editor collaborative with Tiptap Collaboration.

Real-time everything
Offline-first & conflict free
Managed and hosted by us or on your premises

[Learn more](https://tiptap.dev/docs/collaboration/getting-started/overview.md)
