Avatar
Usage
Use an avatar to help people recognize a mechanic, driver or dispatcher at a glance — in assignment lists, work-order headers and comments. Don't use avatars for vehicles or depots; use an icon. An avatar never replaces the name: show the name next to it, or in its accessible name when space is tight.
- Image — profile photo, cropped to a circle.
- Initials — when there's no photo. Two letters, tone chosen by hashing the person's id so it is stable everywhere.
- Fallback icon — unknown or unassigned person ("Unassigned mechanic").
- Sizes — sm 32px (dense tables), md 40px (lists), lg 48px (headers, tablet).
Status text: "Available", "Busy · on WO-4191", "Off shift until 06:00" — always written, the dot only repeats it.
Anatomy
- Container —
.avatar, circle sized by--size-control-* - Content —
img.avatar__img, or.avatar__initials, orsvg.avatar__icon - Status dot (optional) —
.avatar__status[data-status], with its own shape per status - Label (optional) —
.avatar-labelwith name and detail text
Examples
States marked hover and focus-visible are frozen with .is-hover and .is-focus-visible. Those classes share their rule with the real pseudo-class; never use them in product code.
Avatar
Fallback order: photo → initials → generic icon.
<!-- Photo; alt is the person's name -->
<span class="avatar"><img class="avatar__img" src="marta.jpg" alt="Marta Quintero"></span>
<!-- Initials; tone picked from a hash of the person's id -->
<span class="avatar avatar--tone-teal" role="img" aria-label="Idris Okafor">
<span class="avatar__initials" aria-hidden="true">IO</span>
</span>
<!-- Name printed beside it: alt="", status in words -->
<span class="avatar-label">
<span class="avatar"><img class="avatar__img" src="marta.jpg" alt=""><span class="avatar__status" data-status="available"></span></span>
<span class="avatar-label__text"><span class="avatar-label__name">Marta Quintero</span><span class="avatar-label__detail">Available · bay 2</span></span>
</span>
API
| Hook | Values | Purpose |
|---|---|---|
.avatar | block class | Circle container |
.avatar--sm | --lg | modifier class | 32 / 40 (default) / 48px |
.avatar--tone-neutral | --tone-teal | --tone-blue | modifier class | Initials colors; pick with id % 3 |
.avatar__img | __initials | __icon | part classes | Content in fallback order |
.avatar__status + data-status="available|busy|away|off" | part + attribute | Status dot: filled / bar / ring / hollow |
.avatar-label, __text | __name | __detail | companion block | Avatar with name and status text |
Do and don't
Avatar + "Marta Quintero · Available"
Green dot only.
alt="" when the name is printed right next to it
alt="avatar" or alt="profile picture"
Accessibility
Avatars are not interactive. If an avatar opens a profile, wrap it in a link whose name is the person's name.
- Photo:
altis the person's name, oralt=""when the name is visible beside it. - Initials/icon alone: the container gets
role="img"andaria-labelwith the full name; the letters arearia-hidden(otherwise "I O" is read). - Status: the dot is decorative; status is in visible text (or
.sr-onlytext in the name). Each status also has a distinct shape for color-blind users. - Contrast: initials use contrast-checked pairs (
text.default/bg.subtle,selected.fg/selected.bg,feedback.info.fg/feedback.info.bg). - Forced colors: border and status dot render in
CanvasText.
Tokens
| Custom property | Purpose |
|---|---|
--size-control-sm | -md | -lg | Avatar sizes |
--color-bg-subtle / --color-text-default | Neutral initials |
--color-selected-bg | -fg | Teal initials |
--color-feedback-info-bg | -fg | -border | Blue initials |
--color-feedback-success-icon | -danger-icon | -warning-icon | Status dot fills |
--color-bg-surface | Ring that separates the dot from the photo |
--radius-full | Circle shape |