import { AvatarStack, UserAvatar } from "stream-chat-react-native";
<AvatarStack
avatarSize="sm"
maxVisible={3}
overlap={0.3}
items={[
<UserAvatar user={user1} size="sm" />,
<UserAvatar user={user2} size="sm" />,
<UserAvatar user={user3} size="sm" />,
<UserAvatar user={user4} size="sm" />,
<UserAvatar user={user5} size="sm" />,
]}
/>;AvatarStack
AvatarStack renders a horizontal row of overlapping avatars, commonly used to display a list of participants. When the number of items exceeds maxVisible, the remaining count is shown via a BadgeCount component.
A higher-level UserAvatarStack wrapper is also available for convenience when working with user objects.
Usage
Props
items (required)
Array of React nodes (typically avatar components) to display in the stack.
| Type |
|---|
ReactNode[] |
avatarSize
The size key used to determine the diameter of each avatar in the stack. This controls the spacing calculations.
| Type | Default | Values |
|---|---|---|
| string | 'sm' | 'md' | 'sm' | 'xs' |
maxVisible
Maximum number of avatars to display before showing a count badge for the overflow.
| Type | Default |
|---|---|
| number | 3 |
overlap
A value between 0 and 1 that controls how much each avatar overlaps the previous one. 0 means no overlap (avatars side by side); higher values increase the overlap.
| Type | Default |
|---|---|
| number | 0 |
UserAvatarStack
UserAvatarStack is a convenience wrapper around AvatarStack that accepts an array of user objects instead of raw React nodes. Each user is automatically rendered as a UserAvatar.
Usage
import { UserAvatarStack } from "stream-chat-react-native";
<UserAvatarStack
users={[user1, user2, user3, user4, user5]}
avatarSize="sm"
maxVisible={3}
overlap={0.25}
/>;Props
users (required)
Array of user objects to display in the avatar stack.
| Type |
|---|
UserResponse[] |
avatarSize
Same as AvatarStack.avatarSize.
| Type | Default | Values |
|---|---|---|
| string | 'sm' | 'md' | 'sm' | 'xs' |
maxVisible
Same as AvatarStack.maxVisible.
| Type | Default |
|---|---|
| number | 3 |
overlap
Same as AvatarStack.overlap.
| Type | Default |
|---|---|
| number | 0 |