Get started with a Lexical text editor using Liveblocks Storage and React
Liveblocks is a realtime collaboration infrastructure for building performant
collaborative experiences. Follow the following steps to start adding
collaboration to your React application using the APIs from the
@liveblocks/lexical package.
This guide uses Liveblocks Storage. For Comments, mentions, and the full Text
Editor product, see the
@liveblocks/react-lexical quickstart
instead.
Quickstart
Install Liveblocks and Lexical
Every Liveblocks package should use the same version.
TerminalInitialize the
liveblocks.config.tsfileWe can use this file later to define types for our application.
TerminalAdd types for your Lexical document and presence:
liveblocks.config.tsSet up the Liveblocks client
Liveblocks uses the concept of rooms, separate virtual spaces where people collaborate, and to create a realtime experience, multiple users must be connected to the same room. Set up a Liveblocks client with
LiveblocksProvider, and join a room withRoomProvider.Store your editor document as a Storage tree and set an initial presence shape for cursors.
App.tsxJoin a Liveblocks room
After setting up the room, you can add collaborative components inside it, using
ClientSideSuspenseto add loading spinners to your app.App.tsxSet up the collaborative Lexical editor
Now that Liveblocks is set up, create a Lexical editor in
Editor.tsx. UseLiveblocksCollaborationPluginto sync the document with Storage, andRemoteCursorsPluginto show remote carets and selections.Editor.tsxNext: authenticate and add your users
Your editor is set up and working now, but each user is anonymous—the next step is to authenticate each user as they connect, and attach their name and color to remote carets.
Set up authentication and add user information
What to read next
Congratulations! You now have set up the foundation for your collaborative Lexical editor inside your React application.
For Comments, mentions, and default Text Editor components, see
@liveblocks/react-lexical.