Presence surface — who is here, where they are, and the way in
prompts/pkg/llms/surface-presence.md on every deploy, so it
can't drift from what the platform actually does. Read it from your terminal any
time with npx vibes-diy skills.
People who share a live space expect the same four signs they know from Figma, Google Docs and Discord, in the same places:
- Faces in the top corner. A row of overlapping round avatars at the
right end of the room's header, newest last, at most four, then a
+N. Tapping a face opens that person's profile. - A live count. "3 here" beside the faces with a small live dot, and "Just you" when nobody else has arrived, so an empty room reads as waiting rather than broken.
- The invite next to them. One quiet "Invite" button at the end of the row copies the room's link; its label turns to "Link copied" for two seconds.
- Where each person is. On a shared board or canvas, each other person's pointer or selected cell is drawn in their own colour with their handle, the way a Docs cursor carries a name flag. Your own pointer is never drawn.
The bar
The faces are the platform's ViewerTag, which resolves each avatar from the
handle and paints from the look's palette variables on every look. The count
and the invite are the kit's Badge, Dot and Button, so the bar follows
the app's room, its reskin and its type with nothing of its own to restyle.
lib/here.jsx
jsximport React from "react";
import { ViewerTag } from "use-vibes";
import { Badge, Button, Dot, Row, Text } from "@vibes.diy/ui";
/** Everyone in `people` ({ handle, isMe }); `onInvite` copies the room's link. */
export function HereBar({ people, onInvite, onOpenProfile }) {
const [copied, setCopied] = React.useState(false);
const others = people.filter((p) => !p.isMe);
const shown = people.slice(0, 4);
const more = people.length - shown.length;
async function invite() {
await onInvite();
setCopied(true);
setTimeout(() => setCopied(false), 2000);
}
return (
<Row justify="end" align="center" gap="2">
<Row align="center">
{shown.map((p, i) => (
<ViewerTag
key={p.handle}
userHandle={p.handle}
size={28}
avatarOnly
className={i > 0 ? "-ml-2" : undefined}
onClick={onOpenProfile ? () => onOpenProfile(p.handle) : undefined}
/>
))}
</Row>
{more > 0 && <Badge tone="idle">+{more}</Badge>}
<Row align="center" gap="1">
<Dot tone={others.length > 0 ? "up" : "idle"} />
<Text size="sm" muted>{others.length > 0 ? `${people.length} here` : "Just you"}</Text>
</Row>
{onInvite && (
<Button size="sm" variant="quiet" onClick={invite}>{copied ? "Link copied" : "Invite"}</Button>
)}
</Row>
);
}
- Place it once, at the top right of the room (the header row of a board, the thread header of a chat, a corner of the HUD over a 3D world). On a phone the row stays one line: faces first, the count shortens to the number.
- A person's colour is chosen once from their handle and used for their cursor, their selection ring and any name flag, so the same person reads the same everywhere in the room. Pick from the theme's own fills, never a hex:
jsconst PERSON_FILLS = ["fill-primary", "fill-accent", "fill-success", "fill-warning"];
const PERSON_STROKES = ["stroke-primary", "stroke-accent", "stroke-success", "stroke-warning"];
const hue = (handle) => [...handle].reduce((h, c) => (h * 31 + c.charCodeAt(0)) >>> 0, 0) % PERSON_FILLS.length;
Cursors and selections
A cursor rides the person's presence state as board coordinates
({ x, y } in the board's own viewBox units, or { cell: "r2c3" }), never
screen pixels, so it lands on the same spot on every screen size. Draw the
other people over the board in the same SVG, after the board so it sits on
top, with pointer-events-none so it never steals a tap:
jsx<g className="pointer-events-none">
{people.filter((p) => !p.isMe && p.state).map((p) =>
p.state.cell ? (
<rect key={p.handle} {...cellBox(p.state.cell)} rx="2" className={`fill-none ${PERSON_STROKES[hue(p.handle)]}`} strokeWidth="1.5" />
) : (
<g key={p.handle} transform={`translate(${p.state.x} ${p.state.y})`}>
<path d="M0 0 L0 9 L2.5 6.5 L5 11 L6.5 10 L4 5.5 L7.5 5.5 Z" className={`${PERSON_FILLS[hue(p.handle)]} stroke-background`} strokeWidth="0.6" />
<text x="8" y="12" fontSize="4" className={PERSON_FILLS[hue(p.handle)]}>{p.handle}</text>
</g>
)
)}
</g>
- Update the pointer from
onPointerMoveinto the presence state ref (the board'sgetScreenCTM().inverse()turns a pointer intoviewBoxunits); the heartbeat sends it. Clear it tonullononPointerLeave. - A person whose state goes quiet fades after a few seconds rather than staying pinned where they last pointed; the bar keeps their face until they leave.
- A 3D world draws other people as figures in the scene from the same state; the bar still sits over the HUD.
On a look without the kit
An app in the person's own style draws the same three parts with its own
elements: the ViewerTag row unchanged, the count as a small label with a dot
in the theme's success colour, and the invite as the app's quiet button. The
places and the words stay the same.