Avatar group
An avatar group stands several marks together: the people on a record, the members of a workspace. The members overlap by 3px, scaled with the surface, and the first stands on top. The app chooses the people, any overflow count and what pressing one does.
Try it
Section titled “Try it”Members overlap by 3px, the first on top. A lead stands 4px apart from them.
<ds-avatar-group role="group" aria-label="Three people">
<ds-avatar initial="A" color="#99ff73" outlined></ds-avatar>
<ds-avatar initial="J" color="#f5aad1" outlined></ds-avatar>
<ds-avatar initial="M" color="#fec20d" outlined></ds-avatar>
</ds-avatar-group>
<ds-avatar-group role="group" aria-label="Studio and two people">
<ds-avatar slot="lead" shape="square" initial="S" color="#ccccff" label="Studio"></ds-avatar>
<ds-avatar initial="A" color="#99ff73" outlined></ds-avatar>
<ds-avatar initial="J" color="#f5aad1" outlined></ds-avatar>
</ds-avatar-group> <ds-avatar-group role="group" aria-label="Three people"> <ds-avatar initial="A" color="#99ff73" outlined></ds-avatar> <ds-avatar initial="J" color="#f5aad1" outlined></ds-avatar> <ds-avatar initial="M" color="#fec20d" outlined></ds-avatar></ds-avatar-group>Behaviour
Section titled “Behaviour”Each element directly in the default slot is a member, whatever it is: an avatar, a button around one, a count. The group gives each member its place and its stacking order, and keeps them right as members are added, moved or removed. A member with hidden leaves the group and takes up no room, and the next one then starts the row.
An element in the lead slot stands before the members and does not overlap them: a workspace before its people. It stands 4px from the first member while there are members to stand beside.
vertical stands the group in a column. Members overlap by the same 3px as in a row, and a lead stands 4px above them.
The group owns no actions. A button in it keeps its own press, and a member moved out of the group, or into another one, gets back the styles it had.
Accessibility
Section titled “Accessibility”The group adds no role of its own. Where the marks say something together, give it role="group" and an aria-label. Each avatar keeps its own name. Controls inside it keep their order for the keyboard: the first in the markup comes first.
| Attribute | Type | Default | What it does |
|---|---|---|---|
vertical | boolean | false | Stands the group in a column. |
size | string | default | Kept for products that still name compact. Avatars have one size, and it changes nothing. |
| Slot | What it holds |
|---|---|
| Default | The members. |
lead | Marks before the members, not overlapped. |
| Token | What it does |
|---|---|
--ds-avatar-group-members-display | The display of the members’ box, inline-flex by default. |
The element sets --ds-avatar-group-order and --ds-avatar-group-inset on each member itself; do not set them by hand. It has no events.
Copy avatar and avatar-group through Sync 1. On Apple platforms it is DS1AvatarGroup.