Components

Avatar

Displays a user's profile image with a fallback to initials or an icon when unavailable.

Stable
GitHub
JD

Anatomy

Anatomy
import {Avatar} from '@staffbase/design';

<Avatar.Group>
  <Avatar.Root>
    <Avatar.Image />
    <Avatar.Fallback />
  </Avatar.Root>
  <Avatar.GroupCount />
</Avatar.Group>;

Examples

Sizes

Pass name to Avatar.Fallback to derive a consistent fallback colour from the user’s name — the same name always maps to the same colour.

JDTBKPLHAW

Icon fallback

Omit name to show a generic icon on a grey background when no user identity is available.

Group

Use Avatar.Group to stack multiple avatars. Use Avatar.GroupCount to show an overflow count.

U1U2U3
+4

API reference

Root

Inherits props fromBase UI Avatar Root
NameTypeDescription
size
4840322416
The size of the avatar in pixels.
Default:40

Image

Inherits props fromBase UI Avatar Image

Renders the avatar image. Falls back to Fallback when the image fails to load or has no src.

NameTypeDescription
src
string
The URL of the avatar image.
alt
string
Accessible description of the image for screen readers.

Fallback

Inherits props fromBase UI Avatar Fallback

Shown when no image is available or the image fails to load.

NameTypeDescription
name
string
Derives a consistent fallback colour from the user's name. The same name always maps to the same colour. Omit to show a grey background with no derived colour.
children
ReactNode
Fallback content — typically two-character initials, or an icon when no user identity is available.

Group

Stacks multiple avatars with overlapping rings.

GroupCount

Displays an overflow count alongside a group of avatars.