Avatar Group

Free

A stack of avatars with a limit: the rest collapse into a "+N" chip whose accessible name says who it hides, and the stack is a list named for the group.

</>sv-avatar-group avatargroupstackteamoverflow

Complexity tier: Primitive Presents a value: held to semantic markup and contrast, laid out with logical properties so it mirrors under right-to-left, and with what it does on paper decided.

import { SvAvatarGroupComponent } from '@styloviz/avatar';

Demo & usage

Basic usage

Usage example — open the gallery for the full interactive demo.

An interactive demo for this component lives in the gallery.

Open live demo

More examples

The overflow as a button

example.htmlAngular
<sv-avatar-group [members]="team" [max]="3" [overflowAction]="true" (overflowClick)="openTeam($event)" />

When to use

  • Showing who is on a team, a thread or a document without listing everyone.
  • For one person use Avatar; for a full roster use a List View.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
membersreadonly AvatarGroupMember[][]The people in the group, in display order.
maxnumber4The most avatars drawn before the rest collapse into "+N". Values below 1 count as 1. When exactly one would be hidden it is drawn instead — a "+1" chip takes the same room as the avatar it hides.
sizeAvatarSize'sm'Avatar size.
shapeAvatarShape'circle'Avatar shape.
labelstring''The group's accessible name, e.g. "Reviewers". Empty uses "Group of N people".
overflowActionbooleanfalseRender the "+N" chip as a button that emits `overflowClick`.
localestringsvLocale()BCP 47 locale for the counts.

Outputs

EventPayload typeDescription
overflowClickreadonly AvatarGroupMember[]The "+N" chip was activated (only with `overflowAction`); payload is the hidden members.

<sv-avatar-group-pro>

Also in this family — SvAvatarGroupProComponent from @styloviz-pro/avatar.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
membersreadonly AvatarGroupMember[][]The people in the group, in display order.
maxnumber4The most avatars drawn before the rest collapse into "+N". Values below 1 count as 1. When exactly one would be hidden it is drawn instead — a "+1" chip takes the same room as the avatar it hides.
sizeAvatarSize'sm'Avatar size.
shapeAvatarShape'circle'Avatar shape.
labelstring''The group's accessible name, e.g. "Reviewers". Empty uses "Group of N people".
overflowActionbooleanfalseRender the "+N" chip as a button that emits `overflowClick`.
localestringsvLocale()BCP 47 locale for the counts.

Outputs

EventPayload typeDescription
overflowClickreadonly AvatarGroupMember[]The "+N" chip was activated (only with `overflowAction`); payload is the hidden members.

Customization & theming

  • `max` avatars are drawn (never hiding exactly one — a "+1" takes the room of the avatar it hides); `size` and `shape` pass through to every avatar and the chip matches them.
  • Members are `{ id?, name, src?, color?, status? }`; `id` keys the list.

Best practices

  • Do: Name the group with `label` ("Reviewers", "Design team") — without it the list is named "Group of 8 people", which is true but says nothing about who they are to the reader.
  • Do: Use `overflowAction` and open the full list from `(overflowClick)` wherever the hidden people matter; the chip's tooltip is mouse-only.
  • Don't: Don't hand-build a stack with negative margins: it has no limit, no "+N", no group name, and `-space-x` overlaps the wrong way in right-to-left.

Accessibility

  • A `role="list"` named by `label` (or "Group of N people"), one list item per avatar, each avatar still named by its person.
  • The "+N" chip is `role="img"` (or a `<button>` with `overflowAction`) named with the count and the hidden names ("3 more: Alan Turing, Barbara Liskov, Ken Thompson"), with the same names as a tooltip.
  • The overlap uses logical margins (`-ms-2`), so the stack runs the right way under `dir="rtl"`.

Feedback on Avatar Group

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.