Avatar provides a way to display an image, icon or initials to the user.

Igx Module
IgxAvatarModule
Igx Theme
igx-avatar-theme, igx-icon-theme
Igx Keywords
avatar, profile, picture, initials
Igx Group
Layouts

Remarks

The Ignite UI Avatar provides an easy way to add an avatar icon to your application. This icon can be an image, someone's initials or a material icon from the Google Material icon set.

Example

<igx-avatar initials="MS" shape="rounded" size="large">
</igx-avatar>
new IgxAvatarComponent(): IgxAvatarComponent

Returns IgxAvatarComponent

Returns the aria-label attribute of the avatar.

ariaLabel: string = 'avatar'

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:66

Example

let ariaLabel = this.avatar.ariaLabel;

Sets the background color of the avatar.

bgColor: string

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:167

Example

<igx-avatar bgColor="yellow"></igx-avatar>

Sets the color of the avatar's initials or icon.

color: string

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:152

Example

<igx-avatar color="blue"></igx-avatar>

Sets an icon to the avatar. All icons from the material icon set are supported.

icon: string

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:189

Example

<igx-avatar icon="phone"></igx-avatar>

Sets the id of the avatar. If not set, the first avatar component will have id = "igx-avatar-0".

id: string

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:114

Example

<igx-avatar id="my-first-avatar"></igx-avatar>

Sets initials to the avatar.

initials: string

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:178

Example

<igx-avatar initials="MN"></igx-avatar>

Returns the role attribute of the avatar.

role: string = 'img'

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:77

Example

let avatarRole = this.avatar.role;

Returns the type of the avatar. The avatar can be:

  • "initials type avatar"
  • "icon type avatar"
  • "image type avatar".
  • "custom type avatar".
roleDescription: string

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:102

Example

let avatarDescription = this.avatar.roleDescription;

Sets square, rounded or circular shape to the avatar. By default the shape of the avatar is square.

shape: "circle" | "rounded" | "square" = 'square'

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:126

Example

<igx-avatar shape="rounded"></igx-avatar>

Returns the size of the avatar.

get size(): string

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:241

Example

let avatarSize = this.avatar.size;

Returns string

Sets the size of the avatar. By default, the size is "small". It can be set to "medium" or "large".

set size(value: string): void

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:254

Example

<igx-avatar size="large"></igx-avatar>

Parameters

  • value: string

Returns void

Sets the image source of the avatar.

set src(value: string): void

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:201

Example

<igx-avatar src="images/picture.jpg"></igx-avatar>

Parameters

  • value: string

Returns void

Returns the type of the avatar.

get type(): IgxAvatarType

Defined in projects/igniteui-angular/avatar/src/avatar/avatar.component.ts:274

Example

let avatarType = this.avatar.type;

Returns IgxAvatarType