lara-light-indigo

Avatar

Avatar represents people using icons, labels and images.

Label
P
V
U
Label - Circle
P
V
U
Label - Badge
U4
Icon
Icon - Circle
Icon - Badge
4
Image
avatar
avatar
avatar
Avatar Group
avatar
avatar
avatar
avatar
avatar
+2
Image - Badge
avatar4
Import via Module

import { Avatar } from 'primereact/avatar';
import { AvatarGroup } from 'primereact/avatargroup';
 
Import via CDN

<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/avatar/avatar.min.js"></script>
<script src="https://unpkg.com/primereact/avatargroup/avatargroup.min.js"></script>
 
Getting Started

Avatar has three built-in display modes; "label", "icon" and "image".


<Avatar label="P" />
<Avatar icon="pi pi-search" />
<Avatar image="user.png" />
 
Sizes

size property defines the size of the Avatar with "large" and "xlarge" as possible values.


<Avatar label="P" size="large"/>
 
AvatarGroup

A set of Avatars can be displayed together using the AvatarGroup component.


<AvatarGroup>
    <Avatar label="P" />
    <Avatar icon="pi pi-search" />
    <Avatar image="user.png" />
    <Avatar label="+2" />
</AvatarGroup>
 
Shape

Avatar comes in two different styles specified with the shape property, "square" is the default and "circle" is the alternative.


<Avatar label="P" shape="circle"/>
 
Badge

A badge can be added to an Avatar with the Badge component.


<Avatar image="user.png" size="xlarge">
    <Badge value="4" severity="danger" />
</Avatar>
 
Templating

Content can easily be customized with the default slot instead of using the built-in modes.


<Avatar>
   Content
</Avatar>
 
Properties of Avatar

Any valid attribute is passed to the root element implicitly, extended properties are as follows;

NameTypeDefaultDescription
labelstringnullDefines the text to display.
iconstringnullDefines the icon to display.
imagestringnullDefines the image to display.
sizestringnullSize of the element, valid options are "large" and "xlarge".
shapestringsquareShape of the element, valid options are "square" and "circle".
templateanynullTemplate of the content.
imageAltanynullIt specifies an alternate text for an image, if the image cannot be displayed.
Properties of AvatarGroup

Any property as style and class are passed to the main container element. There are no additional properties.

Events
NameParametersDescription
onImageErrorevent: Browser eventThis event is triggered if an error occurs while loading an image file.
onClickevent: Browser eventCallback to invoke on click.
Styling of Avatar

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
p-avatarContainer element.
p-avatar-imageContainer element in image mode.
p-avatar-circleContainer element with a circle shape.
p-avatar-textText of the Avatar.
p-avatar-iconIcon of the Avatar.
p-avatar-lgContainer element with a large size.
p-avatar-xlContainer element with an xlarge size.
Styling of AvatarGroup
NameElement
p-avatar-groupContainer element.
Accessibility

This section is under development. After the necessary tests and improvements are made, it will be shared with the users as soon as possible.

Dependencies

None.

Component Scale

Input Style

Ripple Effect

Free Themes

Built-in component themes created by the PrimeReact Theme Designer.

Bootstrap
Blue
Purple
Blue
Purple
Material Design
Indigo
Deep Purple
Indigo
Deep Purple
Material Design Compact
Indigo
Deep Purple
Indigo
Deep Purple
Tailwind
Tailwind Light
Fluent UI
Blue
PrimeOne Design - 2022 NEW
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
PrimeOne Design - 2021
Saga Blue
Saga Green
Saga Orange
Saga Purple
Vela Blue
Vela Green
Vela Orange
Vela Purple
Arya Blue
Arya Green
Arya Orange
Arya Purple
Premium Themes

Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.

Soho Light
Soho Dark
Viva Light
Viva Dark
Mira
Nano

Legacy Free Themes

Nova
Nova Alt
Nova Accent
Luna Blue
Luna Green
Luna Amber
Luna Pink
Rhea

Premium Create-React-App Templates

Beautifully crafted premium create-react-app application templates by the PrimeTek design team.

Sakai
Atlantis
Freya
Ultima
Diamond
Sapphire
Serenity
Babylon
Avalon
Apollo
Roma