---
title: "Collaboration extension"
description: "Learn how to set up and use collaborative editing with the Collaboration extension in Tiptap."
---

> This page is for Tiptap 2.x. [See the latest version of this page.](https://tiptap.dev/docs/editor/extensions/functionality/collaboration.md)

# 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/v2/collaboration/getting-started/overview.md), which is a cloud and on-premises collaboration server solution.

> **Interactive demo:** [CollaborationSplitPane](https://v2--tiptap-embed.netlify.app/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/v2/collaboration/getting-started/overview.md).

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

## 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 default 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()  | <kbd>Control</kbd> + <kbd>Z</kbd>                                                         | <kbd>Cmd</kbd> + <kbd>Z</kbd>                                                     |
| redo()  | <kbd>Shift</kbd> + <kbd>Control</kbd> + <kbd>Z</kbd> or <kbd>Control</kbd> + <kbd>Y</kbd> | <kbd>Shift</kbd> + <kbd>Cmd</kbd> + <kbd>Z</kbd> or <kbd>Cmd</kbd> + <kbd>Y</kbd> |

## 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/v2/collaboration/getting-started/overview.md) for a fully hosted on on-premises collaboration server solution.

- [Collaboration](https://tiptap.dev/docs/v2/collaboration/getting-started/overview.md): 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
