We've released Liveblocks 2.0 and our new core products, one of which includes new text editor packages for Lexical. We've also added some new React hooks, and created lots of new content.
A large part of the new update is the TypeScript improvements, which makes
handling types easier than before. In Liveblocks 2.0 you now define a
<LiveblocksProvider>, instead of creating a client.
You then define your types in your config file, and import the hooks from our
package. These types are automatically shared across all Liveblocks packages,
even on Node.js, not just the React package.
We have a full interactive tutorial that teaches you the concepts behind setting
up your collaborative React application, and we’ve just rewritten it to support
Liveblocks 2.0.
Each page guides you through a different facet of setting up your app, and using
basic Liveblocks features. Get started with our
interactive tutorial
now.
As part of our new Text Editor product, we’ve released new packages for
Lexical. The first package,
@liveblocks/react-lexical,
allows you to easily create, or convert your existing Lexical editor, into a
collaborative text editor with real-time editing, mentions, comments, and
notifications.
The second package,
@liveblocks/node-lexical,
allows you to connect to the editor from the server, and make changes in
real-time, for example adding a new paragraph.
awaitwithLexicalDocument({ roomId:"my-room-id", client: liveblocks },async(doc)=>{await doc.update(()=>{// Adding a "hello world" paragraph to your editorconst root =$getRoot();const paragraphNode =$createParagraphNode(); paragraphNode.append($createTextNode("Hello world")); root.append(paragraphNode);});});
This API mirrors the client API for Lexical, and all changes occur in real-time.
Our new
Next.js Lexical example
shows you how to set up a collaborative rich-text editor with inline mentions,
comments and notifications, powered by Liveblocks.
Our new
Next.js custom notifications example
guides you through triggering custom notifications on the server, before
rendering custom React components to match.
The
useStorageStatus
is a hook that returns whether local Storage changes have been synchronized or
not. This is helpful for building a status badge in your application, that tells
users if their changes have been saved or not.
functionStatusBadge(){const status =useStorageStatus(); return<div>{status ==="synchronized"?"✅ Saved":"🔄 Saving..."}</div>;}
We recently released the Liveblocks Collaboration Kit for Figma, a set of UI
elements to help you visualize what a collaborative version of your product
would look like.