UserAvatar

fun UserAvatar(user: User, modifier: Modifier = Modifier, indicator: AvatarPresenceIndicator = AvatarPresenceIndicator.None, showBorder: Boolean = false)

The default user avatar content.

This component displays the user's uploaded image or falls back to their initials if no image is available. It is commonly used in message lists, headers, and user profiles.

Parameters

user

The user whose avatar will be displayed.

modifier

The modifier to be applied to this layout.

indicator

The presence indicator to overlay on the avatar. Defaults to AvatarPresenceIndicator.None.

showBorder

Whether to draw a border around the avatar to provide contrast against the background.


fun UserAvatar(user: User, modifier: Modifier = Modifier, showIndicator: Boolean, showBorder: Boolean = false)

Deprecated

Use the overload that takes an AvatarPresenceIndicator. showIndicator showed a grey dot when the user was offline; pass an explicit indicator to control the online, offline, and hidden states.

Replace with

import io.getstream.chat.android.compose.ui.components.avatar.AvatarPresenceIndicator
UserAvatar(user, modifier, if (showIndicator) (if (user.online) AvatarPresenceIndicator.Online else AvatarPresenceIndicator.Offline) else AvatarPresenceIndicator.None, showBorder)

The default user avatar content.

Parameters

user

The user whose avatar will be displayed.

modifier

The modifier to be applied to this layout.

showIndicator

Whether to overlay a status indicator to show whether the user is online.

showBorder

Whether to draw a border around the avatar to provide contrast against the background.