skip to content

Avatars & Badges

Avatars show a person or entity with fallbacks when the image fails, and badges add counts or status. Interviewers probe count caps like 99+ and status that does not rely on color alone.

part ofDesign systems & UX foundationsoverview, primer and where to startread it →
on this pageshow

questions

4

In a design system's avatar component, what should the avatar show when a person's photo is missing or fails to load?

level: juniorimportance: must knowfreq 55%

answer

  1. never a broken image
  2. a chain, not one fallback
  3. photo, then initials, then placeholder
  4. same person, same color everywhere
  5. entity type shapes the placeholder

basics

~20 s

An avatar falls through a fixed chain: the photo once it loads, otherwise the person's initials on a stable background color, otherwise a generic placeholder glyph. The frame and size never change, so nothing breaks or shifts.

solid answer

~40 s

I specify the avatar as a **fallback chain**, not a single image. First the photo; while it is missing, loading or has failed, the avatar shows **initials** from the name (usually first and last, one character for a single name) on a background color picked deterministically from the account's stable ID, so a person looks the same everywhere. If there is no usable name either, it shows a **placeholder** glyph, with a different shape or glyph for an organization than for a person. Every step renders in the same frame, so a failure never surfaces as a broken-image icon or a layout jump. Holding the initials to text contrast is the safe default, and the text alternative is the person's name at every step, or nothing when the name is already printed beside it.

go deeper

for a junior

Recall the three steps in order — photo, initials, placeholder — and that the frame never changes size. Be ready to say what triggers each step.

for a middle

Explain why initials show during loading as well as after errors, why the color comes from a hash of a stable ID, and the initials edge cases: single names, symbols, other scripts.

for a senior

Show the production judgment: legible initials across every palette color, one text alternative across all steps, decorative treatment beside printed names, and entity-aware placeholders tested with real international names.

for a principal

Frame the avatar as shared identity infrastructure: one chain and one color rule for every product surface, so identity looks consistent across teams, and changes to it are rolled out as a system decision.

## What the avatar has to guarantee An **avatar** is a small, fixed-size representation of a person or an entity (a client company, an agency, a team) shown beside comments, in message threads, on proposal cards and in headers. On a freelance job marketplace it appears dozens of times per screen, for people who never uploaded a photo, whose image link has expired, or whose photo is still downloading on a slow mobile connection. The design problem is therefore not "show a picture" but "always show something recognisable, in the same box, whatever the image does". Three guarantees follow from that: - **Never a broken state.** A failed image must never surface as the platform's broken-image glyph, an empty box or a collapsed element. - **Never a layout shift.** The frame is sized by the avatar's size tier, not by the image, so moving from one step of the chain to the next moves nothing around it. - **Always the same identity.** The same person looks the same on every screen and on every visit. ## The fallback chain A robust spec defines an ordered chain and the trigger that moves down it: 1. **Photo** — shown once it has actually loaded, cropped to the frame the same way everywhere. 2. **Initials** — shown while the photo is absent, still loading, or has failed, as long as a usable name exists. 3. **Placeholder** — a generic glyph when there is neither a photo nor a name that yields initials. | Step | Shown when | Stays the same | |---|---|---| | Photo | the image loaded successfully | frame size, shape, border | | Initials | no photo, still loading, or load error | frame, the person's color | | Placeholder | no photo and no usable name | frame, a neutral color | Showing the initials *while* the photo loads, then swapping the photo in, is common practice. It gives a slow connection something meaningful at once, and it makes the error path identical to the loading path, so there is one fewer state to design and test. ## Deriving initials Initials look trivial and carry most of the edge cases: - **Two characters is the usual maximum** — first given name and last family name. More crowds the frame at small sizes. - **Single names** (mononyms, many company names) give one character. - **Scripts without letter case, or without a given/family split**, can make two-letter initials meaningless. Many systems use the first character, or go straight to the placeholder where initials are not a cultural convention. - **Emoji, punctuation and leading symbols** in display names are stripped before characters are picked. - **Uppercase**, by convention, where the script has case. ## Color for initials The initials step needs a background color, and two rules make it work: - **Deterministic.** Pick from a fixed set of colors by hashing a stable identifier — the account ID, not the display name, which the person can edit. The same person then keeps the same color across screens, devices and sessions. - **Legible.** The initials are text. WCAG 2.2 success criterion 1.4.3 Contrast (Minimum) asks for 4.5:1 for normal text and 3:1 for large-scale text (at least 18 point, or 14 point bold). Text that is pure decoration is exempt, but an avatar is not always decorative, so checking every background in the set against the initials color at 4.5:1 is the safe default. The color is identity reinforcement only. It must never *encode meaning*, such as client versus freelancer: the colors are assigned by hash, not by category, and meaning carried by color alone fails WCAG 1.4.1 Use of Color. If the distinction matters, use shape or a text label. ## Placeholder and entity type The placeholder is the last resort, and it should still say *what kind of thing* this is. A common convention is a circle for people and a rounded square for organizations, each with its own glyph, so a client company and a freelancer stay distinguishable even with no image and no name. The placeholder uses a neutral color outside the identity set, so it is not mistaken for a real person's initials. ## Text alternative across the chain Whichever step renders, the avatar means the same thing, so its text alternative does not change with the step: it is the person's or the entity's name — never a description of the photo. When the name is already printed next to the avatar, as in a comment header, the avatar adds nothing and is treated as decorative so the name is not heard twice. WCAG 1.1.1 Non-text Content (Level A) covers both cases: a text alternative that serves the equivalent purpose, or, for decoration, a way for assistive technology to ignore it. How that name is attached to the element is a naming-mechanism question the accessibility rules own.

  • How should an avatar's initials handle a name written in a script where initials are not a convention?
    Do not force a two-letter rule onto every script. Common practice is to take the first character only, or to skip the initials step and show the placeholder. The spec should say which scripts get which treatment and test with real names, because a two-character rule built for Latin names can produce meaningless or even awkward pairs elsewhere.
  • Why should an avatar's initials background never encode account type, such as client versus freelancer?
    The colors are assigned by hashing an ID to spread identities apart, so any category meaning would be coincidental. If the product needs to show account type, a meaning carried by color alone also fails WCAG 1.4.1 Use of Color. Use a distinct placeholder shape, a glyph or a text label for the category, and leave color as identity reinforcement.
  • What changes in the avatar spec when the avatar sits right next to the person's printed name?
    The avatar becomes redundant for anyone using assistive technology, so it is treated as decorative and ignored, and the name is heard once. When the avatar stands alone, for example in a compact participant row, it carries the name as its text alternative. The fallback step shown does not change either decision.

A conference name badge: the photo badge is best, a printed name in large letters works when there is no photo, and a blank 'Guest' badge is the last resort — but every badge is the same size and clips to the same place.

saying these in an interview costs you the question

  • Showing the platform's broken-image icon when a photo fails is acceptable
  • The avatar frame can resize to fit the loaded photo's dimensions
  • Initials background color can be random on each render because it is decoration
  • Initials avatars can use any background color because contrast rules only cover body text
  • The avatar's text alternative should describe the photo, like 'smiling person in glasses'
  • A failed photo should jump straight to the generic placeholder even when a name exists
open as a page

On a notification badge in a freelance job marketplace, why cap the unread count at 99+, and what must the design still preserve?

level: middleimportance: must knowfreq 50%

basics

~20 s

Capping at 99+ keeps the badge's width bounded over its icon, and beyond two digits the exact number rarely changes what a user does next. The design must still expose the exact count on the destination screen and in the text alternative.

open as a page

In a design system's avatar group, how should a stack of project members' avatars behave when there are more people than fit?

level: middleimportance: should knowfreq 32%

basics

~20 s

An avatar group shows up to a set maximum, then replaces the last slot with a same-size overflow indicator reading +N, where N is the number hidden. Activating it, or a nearby list, reveals everyone; all avatars share one size tier.

open as a page

A freelance marketplace marks each freelancer's avatar with a green, amber or grey availability dot; which users does this fail, and how would you fix the spec?

level: seniorimportance: should knowfreq 45%

basics

~20 s

Dots that differ only in hue fail people with color-vision deficiencies (WCAG 1.4.1), low-vision users when the dot lacks 3:1 contrast against its surroundings (1.4.11), and anyone relying on a text alternative. Fix with distinct shapes, a separating ring, and text.

open as a page