2021-10-14 06:13:50 +08:00
---
description: See other user’ s cursors and their name while they type.
2021-10-15 03:20:21 +08:00
icon: account-pin-circle-line
2021-10-14 06:13:50 +08:00
---
2020-11-06 18:37:30 +08:00
# CollaborationCursor
2021-01-09 01:02:06 +08:00
[![Version ](https://img.shields.io/npm/v/@tiptap/extension-collaboration-cursor.svg?label=version )](https://www.npmjs.com/package/@tiptap/extension-collaboration-cursor)
[![Downloads ](https://img.shields.io/npm/dm/@tiptap/extension-collaboration-cursor.svg )](https://npmcharts.com/compare/@tiptap/extension-collaboration-cursor?minimal=true)
2020-11-06 04:57:25 +08:00
This extension adds information about all connected users (like their name and a specified color), their current cursor position and their text selection (if there’ s one).
2020-09-26 17:36:43 +08:00
2020-11-06 04:57:25 +08:00
Open this page in multiple browser windows to test it.
2020-12-04 00:23:54 +08:00
:::pro Pro Extension
2020-12-01 19:03:50 +08:00
We kindly ask you to [sponsor our work ](/sponsor ) when using this extension in production.
2020-11-06 04:57:25 +08:00
:::
2020-10-29 01:05:20 +08:00
## Installation
```bash
npm install @tiptap/extension -collaboration-cursor
```
2021-02-12 22:02:40 +08:00
This extension requires the [`Collaboration` ](/api/extensions/collaboration ) extension.
2020-10-29 01:05:20 +08:00
## Settings
2021-10-02 07:20:09 +08:00
### provider
A Y.js network provider, for example a [y-websocket ](https://github.com/yjs/y-websocket ) instance.
Default: `null`
### user
Attributes of the current user, assumes to have a name and a color, but can be used with any attribute. The values are synced with all other connected clients.
Default: `{ user: null, color: null }`
### render
A render function for the cursor, look at [the extension source code ](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-collaboration-cursor/ ) for an example.
2020-10-29 01:05:20 +08:00
## Commands
2021-10-02 07:20:09 +08:00
2021-10-28 16:00:16 +08:00
### updateUser()
Pass an object with updated attributes of the current user. It expects a `name` and a `color` , but you can add additional fields, too.
2021-10-02 07:20:09 +08:00
```js
2021-10-28 16:00:16 +08:00
editor.commands.updateUser({
name: 'Philipp Kühn',
color: '#000000',
avatar: 'https://unavatar.io/github/philippkuehn',
})
2021-10-02 07:20:09 +08:00
```
2020-10-29 01:05:20 +08:00
## Source code
2021-04-21 21:31:11 +08:00
[packages/extension-collaboration-cursor/ ](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-collaboration-cursor/ )
2020-10-29 01:05:20 +08:00
## Usage
:::warning Public
The content of this editor is shared with other users.
:::
2021-10-19 00:01:47 +08:00
https://embed.tiptap.dev/preview/Extensions/CollaborationCursor?hideSource
https://embed.tiptap.dev/preview/Extensions/CollaborationCursor