Skip to content

AvatarGroup

import { AvatarGroup } from '@delightstack/components';
View code
<script>
import { AvatarGroup } from '@delightstack/components';
const members = [
{ name: 'Alice', src: '/avatars/alice.jpg' },
{ name: 'Bob', src: '/avatars/bob.jpg' },
{ name: 'Charlie', src: '/avatars/charlie.jpg' },
];
</script>
<AvatarGroup avatars={members} />

When the number of avatars exceeds max, a “+N” overflow indicator appears.

<script>
const team = [
{ name: 'Alice', src: '/avatars/alice.jpg' },
{ name: 'Bob', src: '/avatars/bob.jpg' },
{ name: 'Charlie', src: '/avatars/charlie.jpg' },
{ name: 'Diana', src: '/avatars/diana.jpg' },
{ name: 'Eve', src: '/avatars/eve.jpg' },
{ name: 'Frank', src: '/avatars/frank.jpg' },
];
</script>
<AvatarGroup avatars={team} max={3} />
View code
<AvatarGroup avatars={team} size="0" max={4} />
<AvatarGroup avatars={team} size="2" max={4} />
<AvatarGroup avatars={team} size="3" max={4} />

When expandable is true, clicking the overflow indicator reveals all hidden avatars.

+3
View code
<AvatarGroup
avatars={team}
max={3}
expandable
/>
AJ
BS
CB
DP
View code
<AvatarGroup
avatars={team}
onclick={({ avatar, index }) => openProfile(avatar)}
/>
+3
View code
<AvatarGroup
avatars={team}
max={3}
onoverflowclick={({ remaining }) => showAllParticipants(remaining)}
/>
View code
<AvatarGroup skeleton={loading} skeleton_count={4} avatars={loading ? [] : members} />
PropTypeDefaultDescription
avatarsAvatarData[][]Array of avatar data
maxnumber5Maximum visible avatars before overflow
size'0' | '1' | '2' | '3' | '4' | '5''1'Avatar size (passed to each Avatar)
overlapnumber0.25Overlap ratio (0-1)
direction'left' | 'right''right'Stack direction
ring_colorstring'var(--color-bg)'Ring/border color around each avatar
expandablebooleanfalseClick overflow to reveal all
skeletonbooleanfalseShow loading skeleton
skeleton_countnumber4Number of skeleton circles to show
idstringautoElement ID
classstring''Additional CSS classes
EventDetailDescription
onclick{ avatar: AvatarData, index: number }Individual avatar clicked
onoverflowclick{ remaining: AvatarData[] }Overflow “+N” indicator clicked
interface AvatarData {
src?: string;
name: string;
href?: string;
}
  • Container has role="group" with aria-label="Avatar group"
  • Each avatar has an accessible name from the name field in AvatarData
  • Tooltips display each avatar’s name on hover
  • Overflow indicator has aria-label (e.g., “3 more avatars”)
  • When expandable or onoverflowclick is set, the overflow indicator has role="button" and is keyboard accessible (Enter/Space)
  • Hovered avatar rises slightly with translateY(-2px) for visual feedback