Avatar

Avatar represents people using icons, labels and images.


import Avatar from 'primevue/avatar';
import AvatarGroup from 'primevue/avatargroup';   //Optional for grouping

A letter Avatar is defined with the label property.

Label
P
V
U
Circle
P
V
U
Badge
U

<Avatar label="P" class="mr-2" size="xlarge" />
<Avatar label="V" class="mr-2" size="large" style="background-color: #ece9fc; color: #2a1261" />
<Avatar label="U" class="mr-2" style="background-color: #dee9fc; color: #1a2551" />

<Avatar label="P" class="mr-2" size="xlarge" shape="circle" />
<Avatar label="V" class="mr-2" size="large" style="background-color: #ece9fc; color: #2a1261" shape="circle" />
<Avatar label="U" class="mr-2" style="background-color: #dee9fc; color: #1a2551" shape="circle" />

<Avatar v-badge.danger="4" label="U" size="xlarge" />

A font icon is displayed as an Avatar with the icon property.

Icon
Circle
Badge

<Avatar icon="pi pi-user" class="mr-2" size="xlarge" />
<Avatar icon="pi pi-user" class="mr-2" size="large" style="background-color: #ece9fc; color: #2a1261" />
<Avatar icon="pi pi-user" style="background-color: #dee9fc; color: #1a2551" />

<Avatar icon="pi pi-user" class="mr-2" size="xlarge" shape="circle" />
<Avatar icon="pi pi-user" class="mr-2" size="large" style="background-color: #ece9fc; color: #2a1261" shape="circle" />
<Avatar icon="pi pi-user" style="background-color: #dee9fc; color: #1a2551" shape="circle" />

<Avatar v-badge.danger="4" class="p-overlay-badge" icon="pi pi-user" size="xlarge" />

Use the image property to display an image as an Avatar.

Image
Badge
Gravatar

<Avatar image="/images/avatar/amyelsner.png" class="mr-2" size="xlarge" shape="circle" />
<Avatar image="/images/avatar/asiyajavayant.png" class="mr-2" size="large" shape="circle" />
<Avatar image="/images/avatar/onyamalimba.png" shape="circle" />

<Avatar v-badge.danger="4" class="p-overlay-badge" image="/images/organization/walter.jpg" size="xlarge" />

<Avatar image="https://www.gravatar.com/avatar/05dfd4b41340d09cae045235eb0893c3?d=mp" class="flex align-items-center justify-content-center mr-2" size="xlarge" />

Grouping is available by wrapping multiple Avatar components inside an AvatarGroup.

+2

<AvatarGroup>
    <Avatar image="/images/avatar/amyelsner.png" size="large" shape="circle" />
    <Avatar image="/images/avatar/asiyajavayant.png" size="large" shape="circle" />
    <Avatar image="/images/avatar/onyamalimba.png" size="large" shape="circle" />
    <Avatar image="/images/avatar/ionibowcher.png" size="large" shape="circle" />
    <Avatar image="/images/avatar/xuxuefeng.png" size="large" shape="circle" />
    <Avatar label="+2" shape="circle" size="large" />
</AvatarGroup>

Screen Reader

Avatar does not include any roles and attributes by default. Any attribute is passed to the root element so you may add a role like img along with aria-labelledby or aria-label to describe the component. In case avatars need to be tabbable, tabindex can be added as well to implement custom key handlers.

Keyboard Support

Component does not include any interactive elements.