Skip to main content
Urbicon UI

AvatarGroup

Stacks avatars into an overlapping row for a set of collaborators, assignees, or participants, with a “+N” chip once the count passes max. Pass an items array of Avatar props; a shared size and the cut-out ring apply to every avatar.

Playground

AL
AT
GH
+3
Max
Spacing
Size
<script lang="ts">
  import { AvatarGroup } from '@urbicon-ui/blocks';

  const items = [
    { name: 'Ada Lovelace', status: 'online' },
    { name: 'Alan Turing', initials: 'AT' },
    { name: 'Grace Hopper', randomColor: true, status: 'busy' },
    { name: 'Katherine Johnson', randomColor: true },
    { name: 'Edsger Dijkstra' },
    { name: 'Barbara Liskov' }
  ];
</script>

<AvatarGroup
  {items}
  max={4}
  size="md"
/>

01 Examples

Basic stack

Pass an items array of Avatar props. Each entry becomes an avatar, overlapped with a cut-out ring so the set reads as one unit.
AL
AT
GH
KJ
<AvatarGroup
  items={[
    { name: 'Ada Lovelace' },
    { name: 'Alan Turing' },
    { name: 'Grace Hopper' },
    { name: 'Katherine Johnson' }
  ]}
/>

Overflow — max

When items exceeds max, the group renders max − 1 avatars plus a single “+N” chip, so the total rendered count is exactly max. Here six people cap to four slots.
AL
AT
GH
+3
<AvatarGroup items={team} max={4} />

Sizes

size applies to every avatar and the overflow chip alike. Available: xs, sm, md (default), lg, xl, 2xl.
sm
AL
AT
GH
+3
md
AL
AT
GH
+3
lg
AL
AT
GH
+3
xl
AL
AT
GH
+3
{#each ['sm', 'md', 'lg', 'xl'] as size}
  <AvatarGroup items={team} max={4} {size} />
{/each}

02 Appearance

Spacing

spacing controls the overlap: tight packs the stack, loose spreads it out, normal is the default.
tight
AL
AT
GH
+3
normal
AL
AT
GH
+3
loose
AL
AT
GH
+3
{#each ['tight', 'normal', 'loose'] as spacing}
  <AvatarGroup items={team} max={4} {spacing} />
{/each}

Identity colours

Set randomColor on an item to derive its background colour from its name; the same name always maps to the same colour, so people without a photo stay distinct. An item with a src shows that photo instead, with the same cut-out ring; the others keep their initials.
AL
AT
GH
BL
<AvatarGroup
  items={[
    { name: 'Ada Lovelace', randomColor: true },
    { name: 'Alan Turing', randomColor: true },
    { name: 'Grace Hopper', randomColor: true },
    { name: 'Barbara Liskov', randomColor: true }
  ]}
/>

03 Accessibility

Group semantics

The stack is a role="group" with a localized aria-label (“User avatars” by default). Override it with your own aria-label to name the specific set: “Project collaborators”, “Assignees”.

Per-avatar naming

Each avatar shows its initials (or photo) from name / src; the group's aria-label gives the whole set its context for assistive tech.

The overflow chip is announced

The +N overflow chip carries its own aria-label (+2, +9), so the hidden count is announced.

The overlap ring is decorative

The overlap ring uses borderColor (default: the background behind it). It is decorative; set it to match the background the group sits on so the cut-out effect holds.

04 API Reference

11 props
11 props 1 required
Prop
Type
Default
Description

05 Types

Local type definitions used by this component.

10 types
Name
Kind
Category
Used by
Description

06 Installation

Import

import { AvatarGroup } from '@urbicon-ui/blocks';