Skip to content

Avatar

Represents a user or entity with an image, initials, or a generic fallback icon. Supports status indicators and grouping.

Preview

Sizes and initials

XS
SM
MD
LG
XL

Status indicators

AM
BC
CD

Shapes and group

CI
SQ
A
B
C
+3

Display modes

  1. Image -- renders the provided src as a circular (or square) image.
  2. Initials -- when no image is available, renders up to two characters from the name prop.
  3. Fallback -- when neither image nor name is provided, shows a generic user icon.

Sizes

SizeDimensionsFont size
xs24 px11 px
sm32 px13 px
md40 px14 px
lg48 px16 px
xl64 px20 px

Shapes

  • Circle (default) -- border-radius: full (9999 px).
  • Square -- border-radius: md (8 px).

Status indicator

A small dot on the bottom-right corner of the avatar. Available statuses:

StatusColour
online#22C55E (success)
offline#55575F (grey-500)
busy#EF4444 (error)

AvatarGroup

Renders a stack of overlapping avatars with a +N counter for overflow.

Props

Avatar

PropTypeDefaultDescription
srcstring--Image URL
namestring--Full name (used for initials fallback and alt text)
size'xs' | 'sm' | 'md' | 'lg' | 'xl''md'Avatar dimensions
shape'circle' | 'square''circle'Border radius
status'online' | 'offline' | 'busy'--Status dot indicator
classNamestring--Additional CSS classes

AvatarGroup

PropTypeDefaultDescription
maxnumber--Maximum avatars to show before counter
sizeAvatarSize'md'Size applied to all children
childrenReact.ReactNode--Avatar elements

Code example

React

tsx
import { Avatar, AvatarGroup } from '@thepace/lexicon/components';

function TeamSection() {
  return (
    <>
      {/* Single avatar with image */}
      <Avatar src="/photos/alice.jpg" name="Alice Martin" size="lg" status="online" />

      {/* Initials fallback */}
      <Avatar name="Bob Chen" size="md" />

      {/* Generic fallback */}
      <Avatar size="sm" />

      {/* Square shape */}
      <Avatar src="/logos/acme.png" name="Acme Corp" shape="square" size="lg" />

      {/* Grouped avatars */}
      <AvatarGroup max={3} size="sm">
        <Avatar src="/photos/alice.jpg" name="Alice" />
        <Avatar src="/photos/bob.jpg" name="Bob" />
        <Avatar name="Carol Davis" />
        <Avatar name="Dan Evans" />
        <Avatar name="Eve Foster" />
      </AvatarGroup>
    </>
  );
}

Vanilla HTML

html
<div class="lex-avatar lex-avatar--lg lex-avatar--circle">
  <img src="/photos/alice.jpg" alt="Alice Martin" />
  <span class="lex-avatar__status lex-avatar__status--online"></span>
</div>

<div class="lex-avatar lex-avatar--md lex-avatar--circle">
  <span class="lex-avatar__initials">BC</span>
</div>

<div class="lex-avatar-group">
  <div class="lex-avatar lex-avatar--sm"><!-- ... --></div>
  <div class="lex-avatar lex-avatar--sm"><!-- ... --></div>
  <div class="lex-avatar lex-avatar--sm lex-avatar-group__counter">+3</div>
</div>

CSS class reference

ClassPurpose
.lex-avatarBase avatar styles
.lex-avatar--xs through --xlSize variants
.lex-avatar--circleCircular shape (default)
.lex-avatar--squareSquare shape
.lex-avatar__initialsInitials text
.lex-avatar__statusStatus dot
.lex-avatar__status--onlineOnline status colour
.lex-avatar__status--offlineOffline status colour
.lex-avatar__status--busyBusy status colour
.lex-avatar-groupOverlapping group layout
.lex-avatar-group__counterOverflow counter

Released under the MIT License. A product by the pace.