Initials
Display user initials as a text-based avatar
<div class="nds-avatar nds-lg">
<span class="nds-label">AB</span>
</div>
Icon
Use an icon as the avatar content for generic user placeholders
<div class="nds-avatar nds-lg">
<i class="nds-icon nds-icon-avatar" aria-hidden="true"></i>
</div>
Image
Display a user photo with optional image border
<div class="nds-avatar nds-lg">
<img src="path/to/avatar.jpg" alt="User Avatar">
</div>
Group
Stack multiple avatars together with overlapping or spaced layouts
Built-in Features
No JavaScript required. Renders immediately from HTML markup.
From 24px (XS) to 120px (3XL). Font and icon scale proportionally.
Works on div, a, or button elements for display, navigation, or actions.
Stack avatars with overlapping or spaced arrangement and overflow count.
Usage Guidelines
Best Practices
- Use initials when no profile image is available. Two letters from the user's name
- Use icon avatars for anonymous or system-level users where no identity is needed
- Use image avatars when a real photo is available. Always include
alttext describing the person - Use groups to show participants, collaborators, or team members in a compact space
- Choose the size based on context: XS/SM for inline mentions, MD/LG for cards, XL+ for profile headers
- For icon-only avatars used as buttons or links, add
aria-labelto describe the action or person (for example,aria-label="Open user menu") - For image avatars, write
alttext that names the person or conveys context. Use an emptyalt=""only when the avatar is purely decorative and the name appears nearby in text
Modifier Classes
| Class | Element | Description |
|---|---|---|
nds-square | .nds-avatar | Applies a small border-radius for a rounded-square shape instead of a circle |
nds-image-border | .nds-avatar | Adds a subtle inset outline on image avatars to separate the photo from the background |
nds-stacked | .nds-avatar-group | Overlaps avatars so each one shifts behind the previous, creating a compact layered group |
CSS Custom Properties
| Property | Default | Description |
|---|---|---|
--avatar-size | 40px | Width and height of the avatar. Overridden by each size modifier class |
--avatar-gap | 6px | Spacing between avatars inside .nds-avatar-group |
--avatar-background | --colors-neutral-100 | Fill color of initials and icon avatars |
--avatar-color | --icon-default | Foreground color for initials text and icons |
--avatar-border | --colors-base-white | Border color applied to 3XL avatars and 3XL group members |