Avatar Group
npx @vyui/cli add avatar-groupOverview
VyAvatarGroup overlaps avatars in a compact row, propagates a shared size and color, and can replace hidden children with a +N overflow avatar.
Usage
Child avatars inherit the group's size and color unless they set their own values.
Mixed avatar styles
Features and behavior
- Fragment and comment nodes are flattened so
v-forandv-ifwork in the default slot. - Children are rendered in reverse order inside a reverse row, preserving the first child's visual stacking priority.
- With a positive
max, only the firstmaxavatars remain visible. - Hidden children are represented by an internally rendered
VyAvatarcontaining+N. - An absent, invalid, zero, or negative effective
maxshows all children and no overflow avatar. - A string
maxis parsed withNumber.parseInt.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'md' | Shared child size and overlap spacing. |
color | Color | 'neutral' | Shared child fallback color. |
max | number | string | undefined | Maximum visible children before rendering +N. |
class | any | undefined | Classes merged onto the group root. |
ui | Partial<Record<AvatarGroupSlot, any>> | undefined | Per-instance theme slot overrides. |
Color defaults to primary, secondary, success, info, warning, error, or neutral, and supports registry extensions.
Emits
This component does not emit events.
Slots
| Slot | Props | Description |
|---|---|---|
default | — | Avatar children. Fragments are flattened before limiting and reordering. |
Styling and theming
Override globally through appConfig.ui.avatarGroup or locally with ui.
| UI slot | Purpose |
|---|---|
root | Reverse horizontal group layout. |
base | Border, negative margin, and stacking class applied to every visible and overflow avatar. |
The size variant adjusts overlap from -me-1.5 through -me-3; all sizes use a two-pixel white border. The color variant exists to type and propagate the shared color but adds no classes to the group itself.
Accessibility
Each avatar should have meaningful alt text or be wrapped by a labeled interactive control. The generated +N avatar is visual summary text; if the exact hidden identities matter to assistive technology, provide that information elsewhere in the surrounding interface.
Platform notes
- The theme uses
flex, notinline-flex, because Lynx supportsnone,flex,grid, andlineardisplay modes. - A white border is used instead of Nuxt UI's web
ring-bgtoken; the default theme is light-mode-oriented. - Group values are passed to descendant
VyAvatarcomponents through Vue dependency injection.
Related components
Avatarfor individual profile imagery.Userfor an avatar with text metadata.Tooltipfor exposing additional identity information.