Skip to content

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,
    showIndicator: Boolean = false,
    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.
  • showIndicator: Whether to display the online status indicator for direct conversations. Defaults to false.
  • 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.