UserAvatar
Component that renders an image or a name as an avatar. If the image is null
or unavailable, it uses the name initials. Can also show an "is online" indicator. If needed, the initials font size is gradually decreased automatically until the text fits within the avatar boundaries.
Parameters
Modifier used for styling.
The URL of the image to be displayed. Usually User.image.
The name to be used for the initials. Usually User.name.
The shape of the avatar. CircleShape
by default.
The scale rule used for the image. Crop
by default.
The image content description for accessibility. Null
by default.
The image size to be requested. Original size by default.
Placeholder image to be displayed while loading the remote image.
Placeholder image to be displayed in Compose previews (IDE).
The TextStyle to be used for the initials text. The fontSize
, fontFamily
and fontWeight
properties are used. If the font size is too large, it will be gradually decreased automatically.
Offset to be applied to the initials text.
Flag used to display/hide the "is online" indicator. False
by default.
Alignment of the "is online" indicator. TopEnd
by default.
A custom composable to represent the "is online" indicator. DefaultOnlineIndicator by default.
Handler to be called when the user clicks on the avatar.