This is beta documentation for Stream Chat React SDK v14. For the latest stable version, see the latest version (v13) .

Avatar

Avatar renders a user avatar image with an initials or icon fallback.

Best Practices

  • Always pass userName so the fallback initials and title attribute stay meaningful.
  • Pick a size explicitly and keep it consistent within the same surface.
  • Use ChannelAvatar when rendering channels, because it accepts channel display members and computes the visible stack automatically.
  • Keep custom avatar wrappers lightweight to avoid layout shifts in lists.
  • Use getChannelDisplayImage(channel) when you need the same direct-message image fallback as the SDK.

Basic Usage

Use Avatar in your own headers, previews, or message surfaces:

import { Avatar } from "stream-chat-react";

const CustomUserChip = () => (
  <Avatar imageUrl={user.image} size="md" userName={user.name} />
);

Channel Avatars

For channel previews and headers, prefer ChannelAvatar instead of raw Avatar.

Pass displayMembers when you have group-channel member data. ChannelAvatar and GroupAvatar compute the visible members and overflow badge internally, so you do not need to provide a separate overflow count.

import {
  ChannelAvatar,
  getChannelDisplayImage,
  useChannelPreviewInfo,
} from "stream-chat-react";

const CustomChannelAvatar = ({ channel }) => {
  const { displayTitle, groupChannelDisplayInfo } = useChannelPreviewInfo({
    channel,
  });

  return (
    <ChannelAvatar
      displayMembers={groupChannelDisplayInfo.members}
      imageUrl={getChannelDisplayImage(channel)}
      size="xl"
      userName={displayTitle}
    />
  );
};

UI Customization

You can pass a custom avatar component into surfaces such as ChannelHeader or ChannelListItemUI.

import {
  Avatar,
  type ChannelAvatarProps,
  ChannelList,
  WithComponents,
} from "stream-chat-react";

const CustomAvatar = ({
  imageUrl,
  size = "xl",
  userName,
}: Partial<ChannelAvatarProps>) => (
  <Avatar imageUrl={imageUrl} size={size} userName={userName} />
);

<WithComponents overrides={{ Avatar: CustomAvatar }}>
  <ChannelList />
</WithComponents>;

Props

PropDescriptionType
classNameAdditional class names merged with the default avatar classes.string
imageUrlAvatar image URL. If the image fails to load, Avatar falls back to initials or the default icon.string
isOnlineWhen provided, shows the online/offline badge.boolean
onClickClick handler applied to the root element.(event: React.BaseSyntheticEvent) => void
onMouseOverMouse-over handler applied to the root element.(event: React.BaseSyntheticEvent) => void
sizeAvatar size."2xl" | "xl" | "lg" | "md" | "sm" | "xs" | null
userNameName used for the title attribute and the initials fallback.string