Avatar

Shows who or what acted.

Type

  • MO

    persondefault

  • service

Sizes

  • M

    sm

  • MO

    defaultdefault

  • MO

    lg

States

  • JW

    initials

  • J

    one letter

  • MO
    JW
    and 2 more: Ana Lima, Sam Reyes

    group

Usage

When to use it
Use
A row says who triggered a run, owns a pipeline or approved a change.
Use
A service did the work: the scheduler, a connector, a bot account (type="service").
Use
Several owners on one line (AvatarGroup).
Not for
A kind of thing, such as an engine or a region. Use Tag.
Not for
A logo of a third-party product; use its name in text.

Rules

7 rules
Never
Round an Avatar or its image. Because every corner in Sodium is square, and one round photo is the part everyone notices.
Must
Set type="service" for a machine account, so it shows the server glyph and never initials. Because initials on a scheduler make a machine read as a colleague in an audit trail.
Must
Pass name, or decorative when the name is written beside it. Because name gives the initials and the accessible name; without either, the avatar is an unnamed image.
Should
Set decorative when the person's name is the next text, so it is not read twice.
Must
Serve src from your own origin or a store you control. Because a third-party image tells that host who looked at the run, and fails closed behind a strict content policy.
Must
Give an AvatarGroup a label that says what the people share. Because the group is a list, and "list, 4 items" says nothing about why these four are together.
Should
Use sm in a 32px row, the default in a 40px row, lg in a header.

Accessibility

3 checks
A named avatar is role="img" with its name; decorative ones are aria-hidden.
Initials are ink on the well, 16.4:1 in light and 14.5:1 in dark; the service glyph text-2, 7.0:1.
The +N cell reads "and 3 more" with the hidden names, and shows them on hover.

Edge cases

5 edge cases
Image fails
The initials (or the glyph) stay; nothing breaks.
One-word name
Takes its first two letters; the 20px size takes one.
Email as name
Uses the part before @.
Name in another script
Takes the first letters of that script.
Forced colours
The edge draws in CanvasText.

API

6 props
type
'person' | 'service' default 'person'
name
string
src
string
size
'sm' | 'default' | 'lg' default 'default'
decorative
boolean default false
AvatarGroup max, label, size
number, string, size default 4

Tokens

7 tokens
--well
#f4f3ee
--line
#e2dfd5
--page
#ffffff
--text-1
#161512
--text-2
#55524a
--type-micro
400 11px/14px var(--font-mono)
--type-label-sm
400 12px/16px var(--font-mono)

Install

For your coding agent

GitHub

Please star me pookie

198

A new design system every week

Leave your email before you copy the prompt.