Files
supabase/apps/ui-library/content/docs/tanstack/realtime-cursor.mdx
T
Ivan Vasilov 429aa9d084 fix: More fixes for UI Library (#34552)
* Add realtime chat to the landing page.

* Fix the realtime cursor demo on the landing page.

* Fix a bad spelling of shadcn.

* Fix the wrong link in RR auth.

* Change the demo for reatlime cursor to use predefined names.

* Fix the React Router auth block docs.

* Regenerate the realtime chat code.

* Add a docs field to the clients blocks. Add a missing package to the nextjs client block.

* Add links to additional docs on the auth blocks pages.

* Add additional links to the current user avatar docs.

* Add additional links to the client docs.

* Add additional links to the dropzone docs.

* Add additional links to the avatar stack.

* Add additional links to the realtime cursor.

* Add additional links to the realtime chat.

* Fix the dropzone links.
2025-03-31 18:40:03 +08:00

61 lines
2.0 KiB
Plaintext

---
title: Realtime Cursor
description: Real-time cursor sharing for collaborative applications
---
<div className="flex flex-row -space-x-px w-full">
<BlockPreview name="realtime-cursor-demo" isPair />
<BlockPreview name="realtime-cursor-demo" isPair />
</div>
## Installation
<BlockItem
name="realtime-cursor-tanstack"
description="Renders realtime cursors from other users in a room."
/>
## Folder structure
<RegistryBlock itemName="realtime-cursor-tanstack" />
## Introduction
The Realtime Cursors component lets users share their cursor position with others in the same room—perfect for real-time collaboration. It handles all the setup and boilerplate for you, so you can add it to your app with minimal effort.
**Features**
- Broadcast cursor position to other users in the same room
- Customizable cursor appearance
- Presence detection (automatically joins/leaves users)
- Low-latency updates using Supabase Realtime
- Room-based isolation for scoped collaboration
## Usage
The Realtime Cursor component is designed to be used in a room. It can be used to build real-time collaborative applications. Add the `<RealtimeCursors />` component to your page and it will render realtime cursors from other users in the room.
```tsx
import { RealtimeCursors } from '@/components/realtime-cursors'
export default function Page() {
return (
<div className="w-full min-h-screen">
<RealtimeCursors roomName="macrodata_refinement_office" username="Mark Scout" />
</div>
)
}
```
## Props
| Prop | Type | Description |
| ---------- | -------- | ---------------------------------------------------------- |
| `roomName` | `string` | Unique identifier for the shared room or session. |
| `username` | `string` | Name of the current user; used to track and label cursors. |
## Further reading
- [Realtime Broadcast](https://supabase.com/docs/guides/realtime/broadcast)
- [Realtime authorization](https://supabase.com/docs/guides/realtime/authorization)