Avatar
A person shown as a circle (a photo, two initials, or the person icon), or an organization or app shown as a rounded square.
When to use
- Beside a person's name in rows, tables, card headers, the header's account control, and a person's record (D-CSN-32).
- For an organization or an app: its logo, or its initials when it has none, in a rounded square: a company in a job card, a connected account, an institution.
- Several people at once, as a stack beside their names.
- Product note (Global Games): a chosen character may stand in for a person, in Games only.
When not to use
| Situation | Use instead |
|---|---|
| A product of the family | Its mark (Logo and lock-up); marks are not avatars |
| An icon that stands for an action or a category | An icon tile |
| A status | A status chip or status indicator |
| The ID card photo | The ID card's own photo tile (3cqw corners) |
| A portrait in content | A 4:5 image on rounded-card (canonical §9) |
Anatomy
- Container
.oa-avatar: a circle (person) or a rounded square (--org), clipping its content. - Content, one of: a photo
.oa-avatar__img(object-fit: cover;alt=""); two initials; thepersonicon.oa-avatar__iconat 60% of the size; for organizations, the logo at 64%. - Stack
.oa-avatar-stack(optional): avatars overlapping by 8px, each ringed 2px in the ground color.
Fallback order, decided by the product: photo, then initials, then the person icon (canonical §9, §10.26).
Variants
| Variant | Class | Use for | Key tokens |
|---|---|---|---|
| Person (default) | oa-avatar |
People | --color-primary-container, --color-on-primary-container, --radius-full |
| Organization or app | oa-avatar oa-avatar--org |
Companies, connected accounts, institutions | --color-surface-container-high, --color-on-surface, --radius-box / --radius-12px / --radius-24px |
| Stack | oa-avatar-stack around avatars |
Several people | --color-surface ring (--oa-avatar-ring) |
| Character (Games) | person avatar with the character image | A Games player's chosen avatar | the character art in its own shape |
Sizes
| Size | Height | Padding | Type style | Icon size |
|---|---|---|---|---|
| sm (person default) | 40px (--size-avatar-sm): rows, tables, the header |
— | initials 14px bold (round(40 × 0.36)) |
person 24px |
| md | 56px (--size-avatar-md): card headers, account summaries |
— | initials 20px bold | person 34px |
| lg | 96px (--size-avatar-lg): a profile, a person's record |
— | initials 35px bold | person 58px |
| org sm | 40px, 12px corners | — | initials label-md (14/20 600) |
logo 26px |
| org (default) | 48px (--size-tile-md), 16px corners: company and app logo tiles |
— | initials label-md |
logo 31px |
| org md | 56px, 16px corners | — | initials title-md (18/24 700) |
logo 36px |
| org lg | 96px, 24px corners | — | initials display-sm (36/44 600) |
logo 61px |
Initials are round(size × 0.36) px, bold, line height 1 (canonical §10.26). That formula is for people; organization tiles set their initials in label-md (40 and 48px), title-md (56px), and display-sm (96px), so they stay on the type scale (D-CSN-32). The person sizes are the three avatar tokens only: 32 and 48px retire (D-ARC-23, C-3). Corners are about a third of the size: 12px below 44px, 16px (box) from 44 to 56px, 24px for 64 to 96px (canonical §5.3).
Tokens
| Part | Property | Token |
|---|---|---|
| Person | size | --size-avatar-sm, --size-avatar-md, --size-avatar-lg |
| Person | shape | --radius-full |
| Person | fill, initials | --color-primary-container, --color-on-primary-container |
| Person | initials weight | --font-weight-bold |
| Organization | size | --size-tile-md (default), the avatar sizes |
| Organization | shape | --radius-12px (40px), --radius-box (48 and 56px), --radius-24px (96px) |
| Organization | fill, initials | --color-surface-container-high, --color-on-surface |
| Organization | initials | --text-label-md, --text-title-md, --text-display-sm |
| Stack | overlap | --space-2 (negative inline-start margin) |
| Stack | ring | 2px of --oa-avatar-ring, by default --color-surface |
States
| State | What changes |
|---|---|
| Enabled | The avatar is not interactive. Inside a link or a button (the account control, a person's row), the host draws the states. |
| Selected | Inside a selected choice (a Games avatar picker), the choice draws the 2px primary-ink edge on primary-container (canonical §6.2); the avatar itself does not change. |
| Photo failed | The product swaps in the initials, then the icon; nothing shows broken. |
Behavior
- Initials. The first letter of the first and of the last word of the name, in capitals: "Layla Haddad" is "LH"; a one-word name gives one letter; no name gives the icon (Global ID's
initialsOf). Arabic names give two Arabic letters, which join as Arabic letters do ("لح"; native review). - Photos are short-lived URLs of the person's own approved photo; a failed or missing photo falls back to the initials. Never stock photography, never AI-generated people, never a photo fetched from a third party (canonical §9, D-BCP-36).
- Organizations without a logo get their initials; no logo is fetched from a third party. A company logo sits at 64% of the tile.
- Stacks overlap by 8px; the 2px ring is the ground color, so set
--oa-avatar-ringto the ground's role when the stack sits on a card (--color-card-outlined-container) or a panel. - Characters (Global Games only) stand in for a person avatar in Games, at the same sizes, named ("Avatar: Fox") (D-BCP-39).
Accessibility
- Beside the name, the avatar is decorative:
aria-hidden="true", and its imagealt=""(canonical §10.26). - On its own, it is
role="img"with the person's (or the organization's) name asaria-label; its image keepsalt="". - A stack beside visible names is
aria-hidden; on its own,role="img"named with the people it shows ("Layla Haddad, Rami Khoury, and Nour Saab"). - Contrast. Initials
on-primary-containeronprimary-container13.22:1 (light) and 9.06:1 (dark);on-surfaceonsurface-container-high13.84:1 and 11.10:1. - Text size. The smallest initials are 14px; never shrink an avatar below 40px for a person.
- Forced colors. The fill gives way to the system colors; the initials or the icon stay.
RTL and languages
- Avatars sit at the inline start of their row in both directions; a stack overlaps toward the inline end (
margin-inline-start), so it mirrors. - Initials are never mirrored or reordered: they come from the name as written.
- Product names in an organization's
aria-labelinside Arabic put U+2066 … U+2069 around the Latin name (canonical §14.2).
Content
- Names come from the person's record: Global ID's directory shows the name, and on Arabic pages the Arabic name when the record has one ("ليلى حداد").
- Sample people in docs, demos, and templates are fictional with regional names ("Layla Haddad", "Rami Khoury", "Nour Saab", "Maya Khalil"); sample organizations say "(Demo)" (canonical §9, §12.5).
- A chosen character is named "Avatar: {name}" ("Avatar: Fox").
Do and don't
| Do | Don't |
|---|---|
| Use 40, 56, or 96px for people. | Use 32, 36, 48, 52, or 100px person avatars (retired). |
| Make a person's avatar a circle. | Draw people as rounded squares (Tamakkan today). |
| Hide the avatar from screen readers beside the visible name. | Announce the name twice. |
| Fall back to initials, then the icon. | Show a broken image or a stock portrait. |
Give organizations a rounded square on surface-container-high. |
Put a company on primary-container like a person. |
Code
HTML (reference CSS)
People: sizes, named on their own:
<span class="oa-avatar" role="img" aria-label="Layla Haddad">LH</span>
<span class="oa-avatar oa-avatar--md" role="img" aria-label="Layla Haddad">LH</span>
<span class="oa-avatar oa-avatar--lg" role="img" aria-label="Layla Haddad">LH</span>Beside the name (decorative), and the icon fallback:
<p class="oa-cluster"><span class="oa-avatar" aria-hidden="true">RK</span>Rami Khoury</p>
<span class="oa-avatar" aria-hidden="true"><span class="oa-icon oa-avatar__icon" aria-hidden="true" translate="no">person</span></span>Organizations and apps (the 96px tile holds the University mark, drawn with the two mark inks):
<span class="oa-avatar oa-avatar--org oa-avatar--sm" role="img" aria-label="Qadisha Engineering Partners (Demo)">QP</span>
<span class="oa-avatar oa-avatar--org" role="img" aria-label="Byblos Digital Studio (Demo)">BS</span>
<span class="oa-avatar oa-avatar--org oa-avatar--md" role="img" aria-label="Cedar Lane Analytics (Demo)">CA</span>
<span class="oa-avatar oa-avatar--org oa-avatar--lg" role="img" aria-label="Global University"><svg class="oa-avatar__img" viewBox="120 120 840 840" aria-hidden="true" focusable="false"><path fill="var(--color-mark-accent)" d="M217.61,387.44S307.68,96.37,571.91,126.89c264.23,30.53,328.29,309.4,322.28,431.52,0,0-41.65-260.54-338.08-305.32,0,0-220.39-38.67-338.49,134.34"/><path fill="var(--color-mark-ink)" d="M199.29,446.46l158.76,75.3s-20.34,289.05,175.06,293.1c0,0,158.76,20.37,179.11-205.56l181.16,12.21s-32.56,337.87-347.03,333.79c-314.47-4.05-397.93-264.6-347.06-508.85"/></svg></span>Stack:
<p class="oa-cluster">
<span class="oa-avatar-stack" aria-hidden="true">
<span class="oa-avatar">LH</span>
<span class="oa-avatar">RK</span>
<span class="oa-avatar">NS</span>
</span>
Layla Haddad, Rami Khoury, and Nour Saab
</p>Product note (Global Games), a chosen character (the path is relative to reference/):
<span class="oa-avatar oa-avatar--md" role="img" aria-label="Avatar: Fox"><img class="oa-avatar__img" src="../assets/characters/ch-fox.svg" alt=""></span>Arabic:
<p class="oa-cluster"><span class="oa-avatar" aria-hidden="true">لح</span>ليلى حداد</p>Tailwind CSS v4
<!-- Person, 40px; md size-14, lg size-24. The initials size is round(size × 0.36) through a custom property. -->
<span aria-hidden="true" style="--oa-avatar-font: 14px" class="inline-flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-primary-container text-(length:--oa-avatar-font) font-bold text-on-primary-container select-none">LH</span>
<!-- Organization, 48px, initials text-label-md; 40px rounded-12px (text-label-md), 56px text-title-md, 96px rounded-24px text-display-sm -->
<span role="img" aria-label="Byblos Digital Studio (Demo)" class="inline-flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-box bg-surface-container-high text-label-md text-on-surface">BS</span>
<!-- Stack: each avatar ring-2 ring-surface; every avatar after the first -ms-2 -->React
| Prop | Type | Default | Description |
|---|---|---|---|
name |
string |
— | Required. Gives the initials, and the name when label is set. |
src |
string |
— | A photo; if it fails to load, the initials show instead. |
size |
40 | 56 | 96 (org: 40 | 48 | 56 | 96) |
40 (org 48) |
The initials scale with it. |
variant |
"person" | "org" |
"person" |
org draws the rounded square and the logo at 64%. |
label |
string |
— | Gives the avatar a name of its own (role="img"); leave it out beside the visible name. |
AvatarStack.ring |
string |
"var(--color-surface)" |
The ground color behind the stack. |
<Avatar name={person.name} src={person.photoUrl} size={40} />
<Avatar variant="org" name={company.name} label={company.name} size={48} />