Presence stack

Who is here now: ds::avatar-group's stack with a status on each face, a tooltip per person, the rest in a popover, and arrivals and departures that animate when the host re-renders the list.

Anatomy

 ╭──╮╭──╮╭──╮╭──╮
 │MP││SL││ON││+2│   ← faces (avatar + status dot + optional tone ring), then +K
 ╰─●╯╰─◐╯╰─⊖╯╰──╯
PartTokenWhy
Faceds::avatar, decorative, on a surface backing ringed in surfaceAs avatar-group: the overlap reads as a cut-out on any ground.
Overlap-ms-1 / -1.5 / -2 / -2.5 for xs / sm / md / lgAvatar-group's, so the two match side by side.
Stackingeach face above the next (z from its index)The status dot sits on the far corner; with later faces on top, the next face covered it.
Status dotsuccess / warning / danger / fg-muted, ring-surfaceAvatar's status; see below.
Tone ringa chart series colour (Chart::colour), ring-2 outside the faceThe colour that person's cursor or selection has elsewhere.
+Kneutral-tint + on-neutral-tintAvatar-group's chip.

Status

On ds::avatar as status, so a single avatar can carry it too. Four, each a shape as well as a colour (WCAG 1.4.1): online solid, away half filled, busy solid with a bar, offline a hollow ring. The word goes into the face's name.

Faces

Each face is wrapped in ds::tooltip showing one sentence: "Maya Patel, online, typing…". The trigger is the face's href link, or a span tabindex="0" role="img" named by the same sentence, so a keyboard can reach the tooltip. Hover-cards were the alternative and were rejected: a card of profile details is the host's to design, and a hover-card's delay makes a row of faces slow to scan.

The faces fan out a little on hover and focus-within: a translate, so the layout around the stack never moves.

Coming and going

  • Arriving: @starting-style (Tailwind's starting:), from scale-50, opacity-0, under motion-safe. No script.
  • Leaving: a removed element is gone before CSS can animate it, so x-ds-presence (an enhancement) puts it back where it was as a ghost, data-ds-ghost, aria-hidden, inert, x-ignore, raises data-ds-leaving (the view fades and shrinks it) and removes it after 400 ms. Not under reduced motion.
  • Matching: every face has a wire:key hashed from its key, or its name and image, so Livewire's morph removes the person who left rather than shifting every face along.
  • Announcing (announce): the names before and after, from data-ds-presence-people, are compared and a polite live region says "Kim joined. Sam left". Off by default.

+K

shown = first max; total = max(total, count(people)); K = total - shown. Without href it is a ds::popover listing everyone with status and activity (and "and N more" when total exceeds the list); with href a link.

Accessibility

Rootrole="group", named by label
Facea link or role="img", named "Name, status, activity", focusable
Statusshape plus a word in the name, never colour alone
+Ka button named "3 more" opening a named list, or a link
Liveonly with announce; polite

Do not

  • Do not hang a hover-card on each face. See Faces.
  • Do not key faces by index. A departure then animates the wrong person.
  • Do not announce by default. On a busy document it never stops.

From the package repo: edit this page on GitHub.

Was this page helpful?