Skip to content

Avatar

EAvatar is a visual representation of a user. The EAvatar component is typically used to display user profile pictures or placeholders, such as icons or user initials. It is available in a variety of sizes and shapes. Demo Here

‣ This component can be used by the EAvatarGroup for advanced avatar options.

Import

jsx
import EAvatar from "@components/Elements/EAvatar";
import EAvatarGroup from "@components/Elements/EAvatar/EAvatarGroup";

Usage

It comes in two forms :

  1. A Single Avatar
<EAvatar/>
jsx
<EAvatar title="User Name"/>
<EAvatar src="image_source"/>
  1. Avatar Group
<EAvatarGroup>..

The avatar group displays several avatars together.

jsx
<EAvatarGroup>
  <EAvatar src="image_source1"/>
  <EAvatar src="image_source2"/>
  {/* and more .. */}
</EAvatarGroup>

Props

For EAvatar component, the following props are available:

PropTypeDefaultNote
width[String, Number]-Sets the component's width. Default unit is px.
height[String, Number]-Sets the component's height. Default unit is px.
roundedBooleanfalseIt creates a circular avatar.
squareBooleanfalseCreates a square-shaped avatar.
hrefString-This attribute creates a linked avatar.
toString-This attribute creates a linked avatar.
targetString"_self"It specifies where to open the linked document. _self opens the linked document in the same frame as it was clicked.
sizeString"md"The EAvatar element has three predefined sizes: sm, md, lg.
classNameString-Overrides or extends the component's styles.
srcString-By using image src prop the EAvatar element will be visualized in an image form.
altString-The alt attribute specifies an alternate text for an area, if the image cannot be displayed.
variantString"fill"The EAvatar element can be represented in two ways: fill and alternate. alternate displays the avatar with a light background.
titleString-Title to show in avatar if there is no image src provided. The avatar is generated with initials (e.g Mike Dorsey will be presented as MD).
colorString"primary"The given color is applied to the avatar - utility colors are supported (e.g primary or danger). you'll find a list of built-in classes on the src/styles/_vars.scsspage.
iconObject-By using icon prop the EAvatar element will be visualized in an Icon form. More Info about icons here.

For EAvatarGroup component, the following props are available:

PropTypeDefaultNote
classNameString-Overrides or extends the component's styles.
maxNumber-Limits the number of displayed avatars.
colorString"primary"The given color is applied to the avatar - utility colors are supported (e.g. primary or danger). you'll find a list of built-in classes on the src/styles/_vars.scsspage.

Callback Functions

The EAvatarGroup component contains following callback functions.

FunctionDescription
onSurplusClickCallback fired on surplus avatar click. function(event: React.SyntheticEvent) => void 👇

event: The event source of the callback.

COPYRIGHT