Presence stack

Who is here now: the people on a document, a ticket or a board, each with a status, what they are doing, and the colour their cursor has on the page.

Presence stack

Needs Alpine and the package's script for the tooltips and the "+K" popover. See getting started. The faces leaving with a fade, and announce, are an enhancement on top: without them people still come and go when the page re-renders.

Use it

<x-ds::presence-stack
    label="On this page"
    :max="4"
    :people="$viewers->map(fn ($v) => [
        'name' => $v->name,
        'src' => $v->avatar_url,
        'status' => $v->status,       // online | away | busy | offline
        'activity' => $v->activity,   // 'typing…', 'viewing'
        'tone' => $v->cursor_colour,  // 1–8, or a tone name
    ])"
/>

Props

PropTypeDefaultWhat it does
peoplearray[]Who is here, in order. Each name, and optionally src, initials, status, activity, href, tone and key. Arrays or objects.
maxint—Show at most this many faces, then "+K".
sizexs sm md lgsmAs avatar group.
labelstringPeople hereNames the group, and the full list.
totalintthe number of peopleThe real count, when people holds only some.
hrefstring—Makes "+K" a plain link to the full list instead of a popover.
announceboolfalseSay who joins and who leaves, politely, when the list changes.

Per person:

KeyWhat it does
statusA dot on the face: online (solid), away (half), busy (barred), offline (hollow). A shape as well as a colour.
activityWords after the name: "typing…", "viewing".
toneA ring in that person's colour elsewhere on the page: 1–8 are the chart series colours, or a tone such as accent.
hrefMakes the face a link, to their profile.
keyTells two people apart when they share a name.

Live, with Livewire

Re-render the list when people come and go (an Echo presence channel, a poll). Each face carries a wire:key, so the person who left is the one who fades out, and a person arriving is drawn in from small.

<x-ds::presence-stack :people="$here" :announce="true" />

announce is off by default: on a busy page a stream of "Sam joined" is noise. Turn it on where who is present matters, such as a call or a pairing session.

Accessibility

  • The stack is a named group. Each face takes focus and is read as one sentence, "Maya Patel, online, typing…", which its tooltip shows too.
  • The status is never colour alone: each has its own shape, and its word is in the face's name.
  • "+K" is a button named "3 more" that opens a list of everyone with their status and activity; with href, a link.
  • The fan-out on hover and focus is a transform, so nothing around the stack moves. Under reduced motion faces appear and go without animating.

Don't

  • Don't use it for a fixed list of members. That is an avatar group; this is for who is here now.
  • Don't announce on a busy page. Leave announce off unless arrivals matter.
  • Don't make status the only way to know someone is available. Say it in words where it is acted on.

More in specs/presence-stack.md.


From the package repo: edit this page on GitHub.

Was this page helpful?