Avatar
CometChatAvatar
component displays an image or user's avatar with fallback to the first two letters of the username or group's icon with fallback to the first two letter of the group name.
Properties
Name | Type | Description |
---|---|---|
image | string | Image URL of the avatar |
name | string | Fallback name of the avatar |
avatarStyle | Avatar Style | Styling properties of the element |
Avatar Style
Styling properties and values of the avatar element
Name | Description |
---|---|
width | Sets the width of the element |
height | Sets the height of the element |
border | Sets the border of the element |
outerViewBorder | Sets the border of the outer edge of the element |
outerViewBorderSpacing | Sets the spacing between the profile picture and the outerViewBorder |
borderRadius | Sets the border radius of the element |
backgroundColor | Sets the background color of the element. Reference link |
backgroundSize | Sets the size of the element's background image. Reference link |
nameTextColor | Sets the foreground color of the initials. |
nameTextFont | Sets all the different properties of font for the initials. Reference link |
Usage
- HTML
- Javascript
<!--use the element-->
<cometchat-avatar
[image]="profilePic"
[avatarStyle]="avatarStyle"
></cometchat-avatar>
import { AvatarStyle } from '@cometchat/chat-uikit-angular'; //import the style class.
//profile pic
const profilePic = "image";
//styling properties
avatarStyle = new AvatarStyle({width: "28px",height: "28px"});