components/AvatarStack
import { … } from 'zidane-ui'ui/src/components/AvatarStack.tsx
Components#
AvatarStackComponent#
Renders overlapping faces, then "+N" for the rest.
function AvatarStack<P extends AvatarStackPerson>(props: AvatarStackProps<P>): ElementType parameters
| Name | Type | Description |
|---|---|---|
| P | extends AvatarStackPerson |
Parameters
| Name | Type | Description |
|---|---|---|
| props | AvatarStackProps<P> | The |
Returns
ElementProps
| Name | Type | Default | Description |
|---|---|---|---|
| className? | string | Extra classes on the root. | |
| label? | string | The group's accessible name, when the faces are buttons. | |
| max? | number | 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 | 'sm' | The faces' size. |
| style? | CSSProperties | Inline styles on the root. | |
| testId? | string | Test id on the root. |
Interfaces#
AvatarStackPersonInterface#
A person as AvatarStack draws them.
interface AvatarStackPersonProperties
| Name | Type | Description |
|---|---|---|
| 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 |
| online? | boolean | They are connected now: the online dot. |
| typing? | boolean | They type now: the face's breathing ring ( |
AvatarStackPropsInterface#
Props for AvatarStack.
interface AvatarStackProps<P extends AvatarStackPerson = AvatarStackPerson>Type parameters
| Name | Type | Default | Description |
|---|---|---|---|
| P | extends AvatarStackPerson | AvatarStackPerson |
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| className? | string | Extra classes on the root. | |
| label? | string | The group's accessible name, when the faces are buttons. | |
| max? | number | 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 | 'sm' | The faces' size. |
| style? | CSSProperties | Inline styles on the root. | |
| testId? | string | Test id on the root. |