GitHub
Core
Glass
Brutal
Humanist

Avatar

Avatars represent users or entities with images, initials, or placeholder icons. They support multiple sizes and color themes.

Avatar Playground

Avatar Playground
Preview
Code
Adam Smith
Denver Whitman
Jacob Wilson
Xavier Hernandez
Zakir Khan
Amanda Brooks
Duri Fujimara
Lucy Johnson
Jenifer Williams
Salma Siddiqui
Controls
Type:
Image
Initials
Placeholder
Size:
XXL
XL
L
M
S
XS
XXS
XXXS

Avatar Group Playground

Avatar Group Playground
Preview
Code
+4
Controls
Size:
XXXS
XXS
XS
S
M
L
Max Visible:
2
3
4
5
6

Installation

You can add the avatar component to your project manually:

1

Install the following dependencies:

npm install class-variance-authority
2

Copy and paste the following code into your project.

Loading source code...
3

Update the import paths to match your project setup.

Update the import aliases (e.g. @/components, @/utils) in the copied files to match your project's path configuration.

Basic Usage

Avatar

import { Avatar } from '@versaui/ui/components/Avatar';
// Image avatar
<Avatar type="image" person="adam-smith" size="l" />
// Initials avatar
<Avatar type="initials" initials="JD" color="primary" />
// Placeholder avatar
<Avatar type="placeholder" decorative />

Avatar Group

import { AvatarGroup } from '@versaui/ui/components/Avatar';
<AvatarGroup 
  size="m"
  max={4}
  persons={['adam-smith', 'denver-whitman', 'jacob-wilson', 'xavier-hernandez', 'zakir-khan']}
/>

Avatar Types

Avatars can be photographic, based on initials, or a generic placeholder:

// Image — uses a pre-defined person photo
<Avatar type="image" person="adam-smith" size="l" />
// Initials — displays up to two characters
<Avatar type="initials" initials="JD" color="primary" size="l" />
// Placeholder — generic user silhouette
<Avatar type="placeholder" size="l" />

Color Variants

Avatars with type="initials" or type="placeholder" support five color themes:

<Avatar type="initials" initials="AB" color="neutral" />
<Avatar type="initials" initials="CD" color="primary" />
<Avatar type="initials" initials="EF" color="secondary" />
<Avatar type="initials" initials="GH" color="tertiary" />
<Avatar type="initials" initials="IJ" color="quaternary" />

Overflow Handling

The group automatically calculates overflow based on the max prop:

// Max 3 — fourth avatar becomes a "+1" overflow indicator
<AvatarGroup 
  max={3} 
  persons={['adam-smith', 'denver-whitman', 'jacob-wilson', 'xavier-hernandez']} 
/>
// Full group — no overflow indicator
<AvatarGroup 
  max={5} 
  persons={['adam-smith', 'denver-whitman', 'jacob-wilson']} 
/>

Accessibility

The Avatar component is fully accessible:

  • Decorative avatars: Set decorative to hide from screen readers when the avatar is purely visual
  • Labeled avatars: Provide aria-label for meaningful identification
  • Groups: AvatarGroup conveys the total count and overflow to assistive technology

Avatar Props

PropTypeDefaultDescription
size'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl''m'Avatar size.
type'image' | 'initials' | 'placeholder''initials'Visual type of avatar.
color'neutral' | 'primary' | 'secondary' | 'tertiary' | 'quaternary''neutral'Color theme for initials/placeholder.
personAvatarPerson'adam-smith'Pre-defined person photo (image type).
initialsstringUp to two characters (initials type).
decorativebooleanfalseHide from screen readers.
aria-labelstringAccessible label.

AvatarGroup Props

PropTypeDefaultDescription
size'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l''m'Size for all avatars in group.
personsAvatarPerson[][]Array of person identifiers.
maxnumber4Maximum visible avatars before overflow.
aria-labelstringAccessible label for the group.

On this page