Cómo funciona
A list of round avatars that overlap and wear a ring in the surface colour, so they read as cut-outs on any background. They pop in one after another on a spring. Hovering or focusing one lifts it 4px with a soft shadow and raises it above its neighbours, and a dark tip shows the name and an optional role. The rest collapse into a “+N” chip whose tip lists the hidden names; with onMoreClick it becomes a button. Rows wrap when there is no room, keeping the overlap.
Úsalo para
- Who is on a project, a document or a call, where the faces matter more than the full list.
- Presence: who is viewing now, with online dots.
Busca otra opción cuando
- When people need to read or act on every name: use a list.
Uso
import { AvatarGroup } from './AvatarGroup.jsx'
export function Members({ people, onShowAll }) {
return (
<AvatarGroup
label="Project members"
items={people.map((p) => ({ id: p.id, name: p.name, src: p.photo, status: p.role, online: p.online }))}
max={4}
size="md"
onMoreClick={onShowAll}
/>
)
}Propiedades
| Propiedad | Tipo | Por defecto | Qué hace |
|---|---|---|---|
items | { id?: string, name: string, src?: string, tone?: 1-8, status?: string, online?: boolean }[] | — | People in order. Without src the avatar shows initials on a soft tint; tone picks --ds-chart-N, otherwise it is derived from the name. status is the second line of the tip. |
max | number | 4 | How many faces to show before the rest collapse into “+N”. |
size | 'sm' | 'md' | 'lg' | number | 'md' | 28, 36 or 48px, or any pixel size. |
spacing | 'tight' | 'loose' | 'tight' | Overlap of 22% or 6% of the size. |
onMoreClick | () => void | — | Makes “+N” a button, for example to show everyone. |
label / moreLabel | string / (n, names) => string | 'People' | Accessible name of the list (the count is appended) and of the “+N” chip. |
Accesibilidad
- The group is a list named with its label and count; each avatar is focusable and named with the person and status.
- The tip appears on keyboard focus as well as hover; it is decorative because the name is already the accessible name.
- “+N” announces how many are hidden and their names; with onMoreClick it is a real button.
- Reduced motion removes the pop-in and the lift; tips only fade.
Movimiento
Entrance: 520ms spring scale from 0.6, 45ms stagger. Lift: 320ms spring. Tip: 160ms fade and a 220ms spring rise.
Añádelo a tu proyecto
Copia la instrucción en Codex o Claude Code. El agente lee el código publicado, te muestra lo que va a escribir y añade el componente junto a los tuyos.
AvatarGroup.jsxavatar-group.csstokens.cssREADME.md
Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.



