Usage
Team
Use team for workspace or team avatars. Renders with rounded corners instead
of fully circular.
Size
With an image
Pass any image URL to imageUrl. Falls back to initials if the image fails to
load.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
initials* | string | - | Shown when imageUrl is absent or fails to load. |
imageUrl | string | - | URL of the avatar image. Accepts any image URL or a /api/avatar endpoint URL. |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'md' | Controls the rendered size of the avatar. |
team | boolean | false | Renders with rounded corners instead of fully circular. Use for workspace or team avatars. |
/api/avatar endpoint
A deterministic avatar generator running on the Edge. The same u value always
produces the same result. Responses are cached immutably for one year at both
the CDN and browser level.
Marble (default)
Returns an image/svg+xml response with a unique marble pattern seeded from the
username.
Human portraits
Pass human=true to redirect (307) to one of 30 static portrait PNGs instead.
The portrait is chosen deterministically based on the username.
Marble avatars are a good fallback for real users who haven't uploaded a photo, but human faces set more accurate expectations. They remind viewers that Liveblocks features (cursors, presence, comments…) are driven by real people, not abstract identifiers.
Agents
Pass agent=true to overlay a sparkles icon on the marble avatar. Has no effect
when human=true.
Parameters
| Prop | Type | Default | Description |
|---|---|---|---|
u* | string | - | Username or unique identifier used to seed the avatar. Normalized to lowercase before hashing. |
s | number | 36 | Output size in pixels. Clamped between 16 and 256. Defaults to 36 to match the Avatar component's md size. The SVG viewBox is always 64×64, this only sets the rendered width and height. |
human | 'true' | - | Redirects (307) to one of 30 static portrait PNGs at /avatars/avatar-{n}.png, chosen deterministically from the username. |
agent | 'true' | - | Overlays a sparkles icon centered on the marble avatar. Has no effect when human=true. |