AvatarGroup
Overlapping avatars for a compact "who's involved" cluster, with an optional +N overflow chip.
Last updated
Show codeHide code
<AvatarGroup
items={[
{ name: 'Jordan Lee', src: 'https://i.pravatar.cc/80?img=12' },
{ name: 'Priya Nair' },
{ name: 'Sam Ito', src: 'https://i.pravatar.cc/80?img=5' },
{ name: 'Casey Wren' },
]}
max={3}
/>Add
npx @ava-ui/apogee add avatar-group
Pulls in Avatar.
Usage
---
import AvatarGroup from '@/components/apogee/AvatarGroup/AvatarGroup.astro'
---
<AvatarGroup items={[{ name: 'Jordan Lee' }, { name: 'Priya Nair' }]} max={5} />
Anatomy
itemsmode — pass anitemsarray; AvatarGroup renders anAvatarper entry (each gets the group’ssize) plus a +N overflow chip whenitems.length > max.- Manual mode — omit
itemsand drop<Avatar>children into the default slot instead; you control each avatar’s props (including its ownsize). The overlap (-space-x-2) and ring (ring-2 ring-page) styling apply either way.
API
@composable — exposed to Content Editors in AVA. Any other native <div>
attribute passes through.
| Prop | Type | Default | Description |
|---|---|---|---|
items |
{ src?: string; name?: string; alt?: string }[] |
— | Renders one Avatar per entry. Omit to use the default slot instead. |
max |
number |
— | Show at most this many items, then a +N chip. Omit to show all. Ignored in manual (slot) mode. |
size |
'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' |
'medium' |
Size applied to each generated Avatar and to the overflow chip. Doesn’t affect manually slotted avatars — set their own size. |
class |
string |
— | Extra classes, merged last. |
Sizes
ABCDEF
ABCDEF
ABCDEF
ABCDEF
ABCDEF
Show codeHide code
<AvatarGroup size="xsmall" items={[{ name: 'A B' }, { name: 'C D' }, { name: 'E F' }]} />
<AvatarGroup size="small" items={[{ name: 'A B' }, { name: 'C D' }, { name: 'E F' }]} />
<AvatarGroup items={[{ name: 'A B' }, { name: 'C D' }, { name: 'E F' }]} />
<AvatarGroup size="large" items={[{ name: 'A B' }, { name: 'C D' }, { name: 'E F' }]} />
<AvatarGroup size="xlarge" items={[{ name: 'A B' }, { name: 'C D' }, { name: 'E F' }]} />States
With overflow (items.length > max) vs. without (max omitted or ≥ items.length):
ABCD+2
ABCD
Show codeHide code
<AvatarGroup items={[{ name: 'A B' }, { name: 'C D' }, { name: 'E F' }, { name: 'G H' }]} max={2} />
<AvatarGroup items={[{ name: 'A B' }, { name: 'C D' }]} />Examples
Manual composition — mixed sizes or custom per-avatar props aren’t possible via items:
Show codeHide code
<AvatarGroup>
<Avatar name="Jordan Lee" src="https://i.pravatar.cc/80?img=12" />
<Avatar name="Priya Nair" />
</AvatarGroup>Accessibility
- Each
Avatarcarries its own accessible name (imagealtor the initials fallback’saria-label) — see Avatar. - The
+Noverflow chip is plain visible text (e.g. “+3”), not a control — it’s not focusable and doesn’t disclose the hidden names. If the overflow count needs to be actionable (e.g. open a full list), wrap the group in a<button>yourself; AvatarGroup doesn’t do this.
Tokens
| Token | Used for |
|---|---|
--background-page |
Ring color separating overlapping avatars (ring-2 ring-page) |
--background-neutral |
Overflow chip background |
--foreground-neutral |
Overflow chip text |
Do / Don’t
- Do set
maxfor groups that could grow unbounded (team members, watchers). - Do keep
sizeconsistent within a group. - Don’t mix
itemsand slotted children —items(when set) takes over the default slot entirely. - Don’t expect the
+Nchip to be interactive — it’s static text.
Content
- No component-specific copy — the overflow chip’s “+N” is generated, not authored.