ChannelAvatar

The ChannelAvatar displays a channel avatar that adapts based on the channel state and member count:

  • If the channel has an image set, it displays the channel image.
  • For direct conversations (1:1), it displays the other user's avatar with an optional online indicator.
  • For group channels, it displays a stacked layout of member avatars.

Usage

To use the component, pass the Channel object and the current user to ChannelAvatar:

ChannelAvatar(
    channel = channel,
    currentUser = currentUser,
    modifier = Modifier.size(36.dp)
)

Based on the state of the Channel and the number of members, it shows different types of images:

Default ChannelAvatar Component

Customization

The ChannelAvatar exposes the following properties for customization:

@Composable
fun ChannelAvatar(
    channel: Channel,
    currentUser: User?,
    modifier: Modifier = Modifier,
    indicator: AvatarPresenceIndicator = AvatarPresenceIndicator.None,
    showBorder: Boolean = false,
)
  • channel: The channel whose data to display.
  • currentUser: The current user, used to determine which member's avatar to show in direct conversations.
  • modifier: Modifier for the root component. Useful for the component size, padding, background and similar.
  • indicator: The presence indicator drawn on the avatar: AvatarPresenceIndicator.Online, AvatarPresenceIndicator.Offline, or AvatarPresenceIndicator.None. Defaults to AvatarPresenceIndicator.None.
  • showBorder: Whether to show a border around the avatar. Defaults to false.

The avatar's appearance (shape, initials style, group layout) is managed internally by the component and adapts to the current theme.

Tip:

For deeper customization of channel avatar rendering, you can override the ChatComponentFactory#ChannelAvatar method. See the Component Factory page for details.