When a comment is posted, Liveblocks doesn’t store any user metadata, for example their avatar or name. Instead, it only saves their user ID, which you manually set when authenticating. To fetch user metadata, we provide functions that allow you to return the correct data.
You can set a user’s ID when authenticating your application, for example with
This ID is then used inside Comments to represent the current user, for example
we’re using an email address as a user ID below.
There are two different authentication methods—make sure to follow an authentication guide for your framework to get started.
In Comments, user information is retrieved from a list of user IDs, for example
userIds array and the information you need to return.
In your Liveblocks config file, you’ll find a function named
resolveUsers where you
can return this information.
avatar are required for the default components, but you can
also return custom metadata here. For example, each user may have a
property. You can retrieve these properties in your app with
Comments allows you to search for a user after typing the
When a user types
"@" and searches for a user, Comments will pass you a
property which you can use to return matching user IDs.
You can resolve these search results by editing a function named
in your Liveblocks config file. Here’s what the function might look like if the
user has typed
"@mar" into the input.
If a user has only typed
text is an empty string, and it’s recommended
to return every user.