# components/AvatarStack (zidane-ui)

Import: `import { … } from 'zidane-ui'`. Source: [ui/src/components/AvatarStack.tsx](https://github.com/Tahul/zidane/blob/main/ui/src/components/AvatarStack.tsx).

## Components

### `AvatarStack`

Component.

Renders overlapping faces, then "+N" for the rest.

```ts
function AvatarStack<P extends AvatarStackPerson>(props: AvatarStackProps<P>): Element
```

**Type parameters**

- `P` (`extends AvatarStackPerson`)

**Parameters**

- `props` (`AvatarStackProps<P>`): The [`AvatarStackProps`](https://zidane.si/docs/reference/ui-components-avatar-stack.md#AvatarStackProps).

**Returns** `Element`

**Props**

- `className?` (`string`): Extra classes on the root.
- `label?` (`string`): The group's accessible name, when the faces are buttons.
- `max?` (`number`, default `3`): The most faces drawn; the rest count in the "+N" chip.
- `onPerson?` (`(person: P) => void`): A face (or a row of the chip's card) is pressed. Keep it stable: the faces are memoized on it.
- `people` (`readonly P[]`): The people, in the order to draw them.
- `renderCard?` (`(person: P) => ReactNode`): A face's hover card. Keep it stable: the faces are memoized on it.
- `size?` (`AvatarSize`, default `'sm'`): The faces' size.
- `style?` (`CSSProperties`): Inline styles on the root.
- `testId?` (`string`): Test id on the root.

Source: [ui/src/components/AvatarStack.tsx:168](https://github.com/Tahul/zidane/blob/main/ui/src/components/AvatarStack.tsx#L168)

## Interfaces

### `AvatarStackPerson`

Interface.

A person as [`AvatarStack`](https://zidane.si/docs/reference/ui-components-avatar-stack.md#AvatarStack) draws them.

```ts
interface AvatarStackPerson
```

**Properties**

- `avatar?` (`string`): Their photo's URL.
- `id` (`string`): A stable id: the face's key.
- `lastSeenAt?` (`number`): When they were last active, epoch ms (for a card).
- `name` (`string`): Their name. A blank one reads as `avatarUnnamed`.
- `online?` (`boolean`): They are connected now: the online dot.
- `typing?` (`boolean`): They type now: the face's breathing ring (`Avatar` `typing`). Keep it `false` while they don't, so it fades out.

Source: [ui/src/components/AvatarStack.tsx:23](https://github.com/Tahul/zidane/blob/main/ui/src/components/AvatarStack.tsx#L23)

### `AvatarStackProps`

Interface.

Props for [`AvatarStack`](https://zidane.si/docs/reference/ui-components-avatar-stack.md#AvatarStack).

```ts
interface AvatarStackProps<P extends AvatarStackPerson = AvatarStackPerson>
```

**Type parameters**

- `P` (`extends AvatarStackPerson`, default `AvatarStackPerson`)

**Properties**

- `className?` (`string`): Extra classes on the root.
- `label?` (`string`): The group's accessible name, when the faces are buttons.
- `max?` (`number`, default `3`): The most faces drawn; the rest count in the "+N" chip.
- `onPerson?` (`(person: P) => void`): A face (or a row of the chip's card) is pressed. Keep it stable: the faces are memoized on it.
- `people` (`readonly P[]`): The people, in the order to draw them.
- `renderCard?` (`(person: P) => ReactNode`): A face's hover card. Keep it stable: the faces are memoized on it.
- `size?` (`AvatarSize`, default `'sm'`): The faces' size.
- `style?` (`CSSProperties`): Inline styles on the root.
- `testId?` (`string`): Test id on the root.

Source: [ui/src/components/AvatarStack.tsx:39](https://github.com/Tahul/zidane/blob/main/ui/src/components/AvatarStack.tsx#L39)
