Avatar Group
A row of overlapping avatars with a “+N” overflow chip when there are more
people than max.
Import
Section titled “Import”<script> import AvatarGroup from "@invisible-ui/svelte/AvatarGroup.svelte";</script><script setup> import { AvatarGroup } from "@invisible-ui/vue";</script>import { AvatarGroup } from "@invisible-ui/react";<script type="module"> import "@invisible-ui/elements/define";</script>
<ds-avatar-group></ds-avatar-group>In Elements, assign the people as a property:
<ds-avatar-group label="Project team" max="3"></ds-avatar-group>
<script type="module"> document.querySelector("ds-avatar-group").items = [ { name: "Ada Lovelace" }, { name: "Grace Hopper" }, { name: "Alan Turing" }, { name: "Katherine Johnson" }, ];</script>| Prop | Type | Default | Description |
|---|---|---|---|
items * | AvatarGroupItem[] | — | People ({ name, src?, alt? }); name is the initials fallback. |
max | number | 4 | Visible avatars before the "+N" chip. |
size | "sm" | "md" | "lg" | "md" | Avatar size. |
shape | "circle" | "square" | "circle" | Avatar shape. |
label * | string | — | Accessible name for the group. |
| Prop | Type | Default | Description |
|---|---|---|---|
items * | AvatarGroupItem[] | — | The people in the group. |
max | number | 4 | Maximum avatars to show before collapsing the rest into a "+N" chip. |
size | "sm" | "md" | "lg" | "md" | |
shape | "circle" | "square" | "circle" | |
label * | string | — | Accessible name for the group (announced by screen readers). |
| Prop | Type | Default | Description |
|---|---|---|---|
items * | AvatarGroupItem[] | — | The people in the group. |
max | number | 4 | Maximum avatars to show before the rest collapse into a "+N" chip. |
size | "sm" | "md" | "lg" | "md" | |
shape | "circle" | "square" | "circle" | |
label * | string | — | Accessible name for the group. |
| Attribute | Reactive | Description |
|---|---|---|
label * | yes | the group's accessible name |
max | yes | the avatars shown before the "+N" chip; 4 by default |
size | yes | sm|md|lg |
shape | yes | circle|square |
Reactive attributes re-render the element when they change after the first render.
Properties: items.
The image src is rendered as given: pass only URLs you trust or have
sanitized. See Security.
Accessibility
Section titled “Accessibility”- The group is a labelled list; each avatar exposes its
name(oralt), and the overflow chip announces the remaining count.
Example
Section titled “Example”<AvatarGroup label="Project team" items={[{ name: "Ada Lovelace" }, { name: "Grace Hopper" }]}/>In React:
<AvatarGroup label="Project team" max={3} items={[{ name: "Ada Lovelace", color: "rebeccapurple" }, { name: "Grace Hopper" }]}/>Themeable via --ds-avatar-*.