Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

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…

Read the release notes

user-avatar

CSS-only avatar: a profile photo, an initials fallback stacked under it, an optional presence dot, sizes, shapes and a ring. No JavaScript.

Attributes

Attribute Values Default Description
data-size xs, sm, md, lg, xl, 2xl md Avatar size, 1.5rem to 8rem. Initials never drop below 0.625rem.
data-shape square, rounded circle Border radius style
data-ring boolean - Decorative ring. Kept inside overlap groups; drawn as an outline in forced-colours mode.

Child attributes

Attribute On Values Description
data-fallback <span> boolean Initials or an icon. Sits under the <img>, so it shows when there is no photo or the photo fails to load.
data-status <span> online, away, busy, offline Presence dot. Each state has its own colour and shape (solid, crescent, bar, hollow ring). Give it text; see Accessibility.

Sizes

Avatars come in six sizes for different contexts.

With Image

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.

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.

Shapes

Choose between circle (default), rounded, or square shapes.

Status Indicator

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 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.

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.

Accessibility

  • 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.

Related

↑