Skip to content

AvatarGroup ​

AvatarGroup component to display a series of avatars with overflow management, controlled spacing and before/after slots. Ideal for showing teams, participants or collaborators.

Usage examples ​

Basic AvatarGroup ​

Simple avatar group

vue
<script setup>
const teamMembers = [
  { id: '1', src: 'photo1.jpg', name: 'John Doe', alt: 'John Doe' },
  { id: '2', name: 'Marie Dupont', alt: 'Marie Dupont' },
  { id: '3', src: 'photo3.jpg', name: 'Pierre Martin', alt: 'Pierre Martin' },
  { id: '4', name: 'Sophie Chen', alt: 'Sophie Chen' }
]
</script>

<template>
  <SuAvatarGroup :avatars="teamMembers" />
</template>

API ​

Props ​

PropTypeDefaultDescription
avatarsAvatarProps[][]List of avatars to display
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl''md'Avatar size
variant'circle' | 'rounded' | 'square''circle'Avatar shape
maxnumber5Maximum number of visible avatars
spacing'none' | 'sm' | 'md' | 'lg''md'Spacing between avatars
clickablebooleanfalseClickable avatars

Events ​

EventTypeDescription
@avatar-click(avatar: any, index: number, event: MouseEvent) => voidEmitted when an avatar is clicked

Slots ​

SlotDescription
beforeContent displayed before avatars
afterContent displayed after avatars

Accessibility ​

The AvatarGroup component follows WCAG 2.1 AA standards with complete keyboard navigation and screen reader support.

Publié sous licence MIT.