Skip to content

components/AvatarStack

import { … } from 'zidane-ui'ui/src/components/AvatarStack.tsx

Components#

AvatarStackComponent#

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

TypeScript
function AvatarStack<P extends AvatarStackPerson>(props: AvatarStackProps<P>): Element
Type parameters
NameTypeDescription
Pextends AvatarStackPerson
Parameters
NameTypeDescription
propsAvatarStackProps<P>

The AvatarStackProps.

Element
AvatarStack props
NameTypeDefaultDescription
className?string

Extra classes on the root.

label?string

The group's accessible name, when the faces are buttons.

max?number3

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.

peoplereadonly 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.

ui/src/components/AvatarStack.tsx:168

Interfaces#

AvatarStackPersonInterface#

A person as AvatarStack draws them.

TypeScript
interface AvatarStackPerson
AvatarStackPerson properties
NameTypeDescription
avatar?string

Their photo's URL.

idstring

A stable id: the face's key.

lastSeenAt?number

When they were last active, epoch ms (for a card).

namestring

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.

ui/src/components/AvatarStack.tsx:23

AvatarStackPropsInterface#

Props for AvatarStack.

TypeScript
interface AvatarStackProps<P extends AvatarStackPerson = AvatarStackPerson>
AvatarStackProps type parameters
NameTypeDefaultDescription
Pextends AvatarStackPersonAvatarStackPerson
AvatarStackProps properties
NameTypeDefaultDescription
className?string

Extra classes on the root.

label?string

The group's accessible name, when the faces are buttons.

max?number3

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.

peoplereadonly 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.

ui/src/components/AvatarStack.tsx:39