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

# mds-avatar-stack-item

> `@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-item>` web component is a compound child that represents a single avatar inside an [`<mds-avatar-stack>`](../mds-avatar-stack/AGENTS.md), wrapping an internal `<mds-avatar>` so individual avatars can be overlapped, sized, and counted as a group rather than rendered standalone.

#### Semantic Behavior

- **Compound child only**: It must be a direct slot child of `<mds-avatar-stack>`. It is not meant to be used standalone or mixed with other child types in the stack.
- **Parent-driven sizing**: The visual size of each item is governed by the parent's `size` (`sm` / `md` / `lg`) - the child exposes no `size` prop of its own.
- **Overflow / count badge**: When `count` is set, the item renders as a numeric badge instead of a person. The parent uses this for the trailing "+N" indicator, computed from its `total`.
- **Pass-through to mds-avatar**: It forwards `count`, `initials`, `src`, `tone`, and `variant` straight to its internal `<mds-avatar>`; it adds no events, state, focus, or ARIA of its own.
- **Initials override color**: When `initials` are shown (no image available), they take precedence over `tone` and `variant` so each user stays visually distinguishable within the stack.

#### Properties & Visual Configurations

The shared `tone` / `variant` ladders are defined in [`agents/variants.md`](../../../../agents/variants.md); `tone` accepts only the minimal set (`weak` default, `strong`) and `variant` accepts the avatar color set.

- **`src`**: Use for the primary case - a real user photo. When absent the avatar falls back to `initials`, and only when neither is provided do `tone` / `variant` define the placeholder appearance.
- **`initials`**: Provide a short identifier when no image exists; prefer it over relying on color alone, since it both labels and visually separates users in a dense stack.
- **`count`**: Set only to render an explicit overflow badge manually. In most cases this is computed for you by the parent's `total`, so set it directly only when building the overflow indicator yourself.

## 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-item--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 |
| --- | --- | --- | --- | --- |
| `count` | `count` | `number \| undefined` | - | Specifies number of total avatars, the total number will be subtracted by the slotted ones |
| `initials` | `initials` | `string \| undefined` | - | The user's inizials displayed if there's no image available, initials will override tone and variant senttings to keep user recognizable from others |
| `src` | `src` | `string \| undefined` | - | Specifies the path to the image |
| `tone` | `tone` | `"strong" \| "weak" \| undefined` | `'weak'` | Specifies the color tone of the component |
| `variant` | `variant` | `"amaranth" \| "aqua" \| "blue" \| "error" \| "green" \| "info" \| "lime" \| "orange" \| "orchid" \| "primary" \| "purple" \| "red" \| "sky" \| "success" \| "violet" \| "warning" \| "yellow" \| undefined` | - | Specifies the color variant of the component |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-avatar-stack-item-background` | The background color of each avatar in the stack |
| `--mds-avatar-stack-item-size` | Computed active size (based on selected size) |

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

## Dependencies

Uses: `mds-avatar`.
Used by: `mds-avatar-stack`.
