AvatarGroup
The people of a team, a project or a thread, overlapped. Past max the rest are a count; every name is on hover.
import { AvatarGroup, AvatarGroupSkeleton } from '@sypnia/ui/react'
Teams
- Billing
- Product
- In a table row
- Loading
Code
import { AvatarGroup, AvatarGroupSkeleton, KeyValue } from '@sypnia/ui/react';
// Past max the rest are a count; every name is on hover and read by screen readers.
const people = ['Ana Ruiz', 'Bo Chen', 'Lucía Gómez', 'Diego Mora', 'Eva Lind', 'Femi Ade', 'Gil Sá'].map((name) => ({ name }));
export default function Teams() {
return (
<KeyValue items={[
['Billing', <AvatarGroup key="a" label="Members of Billing" people={people.slice(0, 3)} />],
['Product', <AvatarGroup key="b" label="Members of Product" people={people} max={5} />],
['In a table row', <AvatarGroup key="c" label="Reviewers" size="sm" people={people.slice(1, 6)} max={3} />],
['Loading', <AvatarGroupSkeleton key="d" items={4} />],
]} />
);
} In Astro
Code
---
// The Astro twin.
import AvatarGroup from '@sypnia/ui/astro/AvatarGroup.astro';
---
<AvatarGroup label="People who wrote this page" people={[{ name: 'Ana Ruiz' }, { name: 'Bo Chen' }, { name: 'Lucía Gómez' }, { name: 'Diego Mora' }, { name: 'Eva Lind' }]} max={4} /> Skeleton
Code
import { AvatarGroup, AvatarGroupSkeleton } from '@sypnia/ui/react';
// The group and its skeleton: the same circles, overlapped.
export default function Skeleton() {
return (
<div className="sy-cols sy-cols--stack">
<AvatarGroup label="Members" people={[{ name: 'Ana Ruiz' }, { name: 'Bo Chen' }, { name: 'Lucía Gómez' }]} />
<AvatarGroupSkeleton items={3} />
</div>
);
} When to use it
Use it when
- Who is in a team, who reviewed, who is watching.
Do not use it when
- A list people need to act on: use List with Identity.
For everyone
- The group is named with every person in it: «Members of Billing: Ana Ruiz, Bo Chen and Lucía Gómez».
Props
| AvatarGroup | Type | Default |
|---|---|---|
labelrequiredWhat the group is: «Members of Billing». | string | |
peoplerequired | { name: string; src?: string | undefined; }[] | |
max | number | 4 |
size | "sm" | "md" | "lg" | md |
| AvatarGroupSkeleton | Type | Default |
|---|---|---|
items | number | 4 |
size | "sm" | "md" | "lg" | md |