Avatar group

Free

Who is here, as overlapping glass coins each cut out of the one behind it by a ring of the surface, ending in a grey +N.

npx shadcn@latest add https://pixilui.com/r/avatar-group.json

Preview

Overlapping coins, each cut out of the one behind it.
Size

When to use

Use it when

  • Who is watching a run, who is on a workspace, who approved.

Use something else when

  • One person: use Avatar beside their name.
  • A list people need to read: write the names.

Installation

Terminal
npx shadcn@latest add https://pixilui.com/r/avatar-group.json

Adds avatar-group.tsx with avatar.tsx, and installs clsx and tailwind-merge. The URL works in any app with a components.json, with no registry to add first.

Usage

example.tsx
import { AvatarGroup } from "@/components/pixilui/avatar-group";

<AvatarGroup>Save changes</AvatarGroup>

Each coin overlaps the one before by a fifth of a face; the stack keeps its size and never wraps.

API reference

PropTypeDefault
childrenRequiredReactNode–The coins, as Avatar elements, first in front of the reading order.
morenumber–How many more people there are: shown as a grey +N coin at the end. Zero or less shows nothing.
moreLabelstring–The +N coin's accessible name, such as "3 more people". Without it the coin reads its number.
sizenumber–The coins' size in px, for the +N coin; give the Avatars the same size.

Also takes every native <span> attribute, and a ref.

Keyboard

TabNever takes focus on its own; wrap it in a TooltipGroup with name tips to make each coin a stop.

Accessibility

  • Each coin keeps its own name; the +N coin is named by moreLabel ("3 more people").
  • For name tips that travel along the stack, give each coin a Tooltip with name inside a TooltipGroup.

Motion

  • None of its own: it holds still. A person arriving or leaving uses the foundation's arrive and leave.
AvatarEach person keeps one color, picked from their name.
TooltipOne tooltip travels along a row, its labels sliding past inside it.
KbdCaps press down while you hold their keys.

PixilUI Pro opens soon. The first 20 licenses are $99.