<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-avatar-stack/ in the magma monorepo (usage/*.md and the
  component's JSDoc). Regenerated on every stencil build (scripts/component-docs.ts).
-->

# mds-avatar-stack

> `@maggioli-design-system/magma` 2.15.0. Shadow DOM: style it only through the public CSS custom properties and the parts below.

The `<mds-avatar-stack>` web component groups a set of overlapping `<mds-avatar-stack-item>` children into a single horizontal cluster, the Magma Design System pattern for showing the people associated with an entity (assignees, participants, collaborators) in a compact, space-saving row.

#### Semantic Behavior

- **Compound parent**: It is the container half of a compound component; its visible content is the default slot of `<mds-avatar-stack-item>` children, each of which wraps an `<mds-avatar>`.
- **Size propagation**: `size` drives the dimensions, border, and horizontal overlap of every slotted item, so the whole stack stays visually consistent without sizing each avatar individually.
- **Overflow counter**: When `total` is set and exceeds the number of slotted children, the stack appends one extra item rendering the remainder (e.g. "+3"), so it can represent a larger group than it physically shows.
- **Live composition**: Children are counted again whenever they change: the overflow indicator follows both `total` and the items added or removed after load.

#### Properties & Visual Configurations

- **`size`** selects the avatar scale (`'sm'`, `'md'`, `'lg'`) for the entire stack; pick it to match the surrounding density, since it governs not just avatar diameter but also the overlap offset and ring border between stacked avatars.
- **`total`** is the logical headcount of the represented group. Set it higher than the number of slotted avatars to surface a trailing count item for the hidden members; leave it unset (or equal to the child count) to show only the avatars in the markup with no counter.

This component does not use the shared `variant` / `tone` ladders; per-avatar appearance (tone, variant, initials, image source) is configured on each `<mds-avatar-stack-item>` instead.

## Read next

- [`examples.md`](examples.md) - correct usage, from the most common case
- [`mistakes.md`](mistakes.md) - the wrong forms, each with the right one
- [Storybook](https://magma-design-system.github.io/magma/storybook/?path=/docs/ui-avatar-stack--docs) - the live examples, in the published Storybook of `main`
- [`conventions.md`](../../../../agents/conventions.md), [`variants.md`](../../../../agents/variants.md), [`mistakes.md`](../../../../agents/mistakes.md) - the rules shared by every component

## Props

| Prop | Attribute | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `size` | `size` | `"lg" \| "md" \| "sm" \| undefined` | - | Specifies the size of the slotted avatars elements |
| `total` | `total` | `number \| undefined` | - | Specifies the size of the slotted avatars elements |

## Slots

| Slot | Description |
| --- | --- |
| (default) | Add `mds-avatar-stack-item` elements to display in the stack. |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-avatar-stack-background` | Background color for the avatar stack container |

Only these are public. Its other 11 are internal: they may change in any release, do not set them.

## Dependencies

Uses: `mds-avatar-stack-item`.
