0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Put the photo in an <img>. The alt names the person when the avatar stands alone; use alt="" when the name is printed right next to it.
Avatar with image
123456
<user-avatardata-size="lg"><imgsrc="user-photo.jpg"alt="Jane Doe" /></user-avatar><!-- Name printed beside it: the photo is decorative --><user-avatar><imgsrc="user-photo.jpg"alt="" /></user-avatar> Jane Doe
Fallback (Initials)
With no photo, show initials in a [data-fallback] span. Screen readers spell initials letter by letter, so name the avatar on the host with role="img" and aria-label, and hide the initials.
The fallback sits under the image in the same grid cell. Put both in the avatar, and if the photo fails to load (or is transparent) the initials show through. The browser's alt text and broken-image icon are suppressed. To hide the icon completely in Chromium, give the image alt="" and put the name on the host.
Avatar with initials fallback
123456789
<user-avatardata-size="lg"role="img"aria-label="Jane Doe"><spandata-fallbackaria-hidden="true">JD</span></user-avatar><!-- Photo with initials behind it (shown if the photo fails) --><user-avatardata-size="lg"role="img"aria-label="Jane Doe"><imgsrc="user-photo.jpg"alt="" /><spandata-fallbackaria-hidden="true">JD</span></user-avatar>
Shapes
Choose between circle (default), rounded, or square shapes.
Add a [data-status] span for presence. The four states differ in shape as well as colour, so they still read in forced-colours mode and for colour-blind users. The dot needs text for screen readers: use role="img" with an aria-label, or put the text inside the span, where it is read but clipped visually.
Avatar with status
12345678910
<user-avatardata-size="lg"><imgsrc="user-photo.jpg"alt="Jane Doe" /><spandata-status="online"role="img"aria-label="Online"></span></user-avatar><!-- or: text content, read but not painted --><user-avatardata-size="lg"><spandata-fallbackaria-hidden="true">BY</span><spandata-status="busy">Ben Young, busy</span></user-avatar>
Avatar Group
Stack avatars with data-layout="cluster" and data-layout-overlap on a list, so screen readers announce how many people there are. Point the list at a visible heading with aria-labelledby, and label the +N chip with what it stands for.
Avatar group
1234567891011
<h3id="members">Project members</h3><ulclass="unstyled"data-layout="cluster"data-layout-overlaparia-labelledby="members"><li><user-avatar><imgsrc="jane.jpg"alt="Jane Doe" /></user-avatar></li><li><user-avatar><imgsrc="john.jpg"alt="John Smith" /></user-avatar></li><li><user-avatar><imgsrc="alex.jpg"alt="Alex Johnson" /></user-avatar></li><li><user-avatarrole="img"aria-label="5 more members"><spandata-fallbackaria-hidden="true">+5</span></user-avatar></li></ul>
With Ring
Add a decorative ring around the avatar. The ring is set through a private custom property, so it also survives inside an overlap group, where the cluster gives every item its own separator.
Photo:alt is the person's name when the avatar stands alone (a list of reviewers, a profile link). Use alt="" when the name is printed beside it, as <comment-thread> and <activity-feed> do. Don't write avatar or profile picture.
Initials: put role="img" aria-label="Jane Doe" on the host and aria-hidden="true" on the [data-fallback] span. Otherwise JD is read letter by letter.
Overflow chip: label +5 with what it counts (aria-label="5 more members"). If it is interactive, use a real button or link inside the list item.
Groups: use a <ul> with one <li> per avatar so the count is announced, labelled by a nearby heading (aria-labelledby).
Status: colour is never the only signal. Each state has a distinct shape, and the dot needs text (role="img" aria-label or text content). When the host is a labelled role="img", fold the status into that label (Ada Wong, away).
Forced colours: the disc gets a CanvasText border, the ring an outline, and the status dot keeps its shape in system colours.
Dark mode: the initials disc uses light-dark() tokens and keeps its contrast in both schemes.