import { ChannelAvatar } from "stream-chat-react-native";
<ChannelAvatar channel={channel} size="xl" showBorder />;This is beta documentation for Stream Chat React Native SDK v9. For the latest stable version, see the latest version (v8)
.
ChannelAvatar
ChannelAvatar renders the avatar for a chat channel. It intelligently selects the appropriate avatar representation based on channel data:
- If the channel has a custom image (
channel.data.image), it renders a baseAvatarwith that image. - If the channel is a group with multiple members (excluding the current user), it renders a
UserAvatarGroupshowing members' avatars. - For direct message channels (single other member), it renders a
UserAvatar.
The component also determines online presence from channel state and shows an online indicator when applicable.
Usage
Props
channel (required)
The Stream Chat Channel instance to render the avatar for. The component reads channel.data.image, channel.state.members, and channel.cid to determine the rendering strategy.
| Type |
|---|
Channel |
showOnlineIndicator
Whether to display an online presence indicator. Defaults to the channel's online presence status derived from the useChannelPreviewDisplayPresence hook.
| Type | Default |
|---|---|
| boolean | Online presence from channel state |
size
The size of the avatar.
| Type | Default | Values |
|---|---|---|
| string | 'xl' | 'lg' | 'xl' | '2xl' |
showBorder
Whether to show a border around the avatar.
| Type | Default |
|---|---|
| boolean | true |