Avatar
BetaData displayOpen in the workshop
A person or a team, by initials or picture; partners by square logo tile.
.xg-avatar · --sm --lg · --square · .xg-avatar-stackExample and markup
Live, from xg-ui.css and xg-ui.js. Switch the brand and mode on the example itself, or for the whole site in the header.
Markup
<div class="xg-row">
<span class="xg-avatar xg-avatar--sm" role="img" aria-label="Ops team">OT</span>
<span class="xg-avatar" role="img" aria-label="Ad ops">AO</span>
<span class="xg-avatar xg-avatar--lg" role="img" aria-label="Finance">FI</span>
<span class="xg-avatar xg-avatar--square" role="img" aria-label="Partner">P1</span>
<span class="xg-avatar-stack">
<span class="xg-avatar" role="img" aria-label="Ad ops">AO</span>
<span class="xg-avatar" role="img" aria-label="Finance">FI</span>
<span class="xg-avatar" role="img" aria-label="Sales">SA</span>
</span>
</div>States
Hover, focus and pressed are forced here with .is-hover, .is-focus and .is-active so they can be seen side by side; in a product they come from :hover, :focus-visible and :active.
| State | Round | Square |
|---|---|---|
| Small · 24 | AO | AO |
| Medium · 32 | AO | AO |
| Large · 44 | AO | AO |
When to use it
Use it for
the account menu, owners in a table, activity logs.
Not for
decoration.
Rules
- Two initials, uppercase. Partner logos go in the square variant and are never recolored.
Accessibility
- role="img" with aria-label, or empty alt when the name is printed next to it.
Every color pair this component uses is measured for both brands in light and dark on the Accessibility page.
Related
Also in Data display: Data table, Pagination, KPI card, Status badge, Tag, Progress, Chart, Tooltip, Empty state, Skeleton, Spinner.
Status Beta: usable; class names may still change in a minor release, with a note (see Releasing).