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
╰─●╯╰─◐╯╰─⊖╯╰──╯
| Part | Token | Why |
|---|---|---|
| Face | ds::avatar, decorative, on a surface backing ringed in surface | As avatar-group: the overlap reads as a cut-out on any ground. |
| Overlap | -ms-1 / -1.5 / -2 / -2.5 for xs / sm / md / lg | Avatar-group's, so the two match side by side. |
| Stacking | each 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 dot | success / warning / danger / fg-muted, ring-surface | Avatar's status; see below. |
| Tone ring | a chart series colour (Chart::colour), ring-2 outside the face | The colour that person's cursor or selection has elsewhere. |
| +K | neutral-tint + on-neutral-tint | Avatar-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'sstarting:), fromscale-50,opacity-0, undermotion-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, raisesdata-ds-leaving(the view fades and shrinks it) and removes it after 400 ms. Not under reduced motion. - Matching: every face has a
wire:keyhashed from itskey, 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, fromdata-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
| Root | role="group", named by label |
| Face | a link or role="img", named "Name, status, activity", focusable |
| Status | shape plus a word in the name, never colour alone |
| +K | a button named "3 more" opening a named list, or a link |
| Live | only 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.