Avatar Stack

A person with a photo or drawn face and presence, or a group overlapping with +N.

Category
Data & feedback
Access
Free with an account
Source
268 lines · one file
States
5 drawn

The decision inside it

+N opens the list

A count you cannot expand is a dead end the moment someone asks who else. The overflow is a button that shows everyone, and a photo that fails to load falls back to the drawn face instead of a broken image.

When to use it

Use UserAvatar for one person (photo, or the Liro face drawn from the name, with presence) and AvatarStack for a group with +N that opens the full list. Pass name always: it is the alt text, the tooltip and the fallback.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Avatar Stack for this.
Install it: npx shadcn@latest add @liro/avatar-stack
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/avatar-stack.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/reviewers.tsx
import { AvatarStack, UserAvatar } from "@/components/ui/avatar-stack";

export function Reviewers() {
  return (
    <div className="flex items-center gap-3">
      <UserAvatar name="Michael Carter" status="online" />
      <AvatarStack
        label="Reviewers"
        max={3}
        people={[{ name: "Priya Raman" }, { name: "Olivia Martinez" }, { name: "Daniel Okafor" }, { name: "Aiko Tanaka" }]}
      />
    </div>
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
namestring YesThe person's name: the alt text, the tooltip, and the seed for the drawn face.
srcstring NoA photo. Falls back to the drawn face (or initials) if it is missing or fails to load.
fallback"face" | "initials" NoWhat to draw without a photo: the Liro face for the name, or initials on a tint. Default face.
sizeAvatarSize Noxs 20, sm 24, md 32, lg 40, xl 56 pixels. Default md.
shape"circle" | "square" NoPeople are circles; square suits a grid of tiles or a bot. Default circle.
status"online" | "away" | "busy" | "offline" NoA presence dot in the corner, also read out with the name.
ringboolean NoA ring in the surface colour, for avatars that overlap or sit on a photo.

Dependencies

npm packages

@radix-ui/react-popoverclsxtailwind-merge

Liro foundations, installed alongside it

liro-themeavatartooltip

States

All of them are drawn by the component. None is left for you to design.

  • Photo
  • Initials
  • Presence
  • Stack
  • Overflow list

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Used in a screenAll screens