Homelogologo
Sponsor

Avatar

Displays a user's profile image or initials

Usage

Show a user's profile picture with a graceful fallback when no image is available or it fails to load.

import { Avatar } from "@elemnts-ui/react"; <Avatar> <Avatar.Image src="..." alt="..." /> <Avatar.Fallback>JD</Avatar.Fallback> </Avatar>;

Sizes

Control the avatar size with the size prop.

Shapes

Change the avatar shape by applying a specific borderRadius value or using style props.

Variants

Switch the avatar’s visual style using the variant prop.

Colors

Customize the avatar’s background and text colors using colorPalette.

Ring

Add an outline ring around the avatar using the outline style props.

With badge

Add a status or notification badge to the avatar using Badge.

API Reference

AvatarRoot

The root component for the avatar.

PropTypeDefault
size2xs | xs | sm | md | lg | xl | 2xlmd
variantprimary | secondary | tetriary | ghost | surfaceprimary
asChildbooleanfalse

AvatarImage

The image component for the avatar.

PropTypeDefault
srcstringundefined
altstringundefined
asChildbooleanfalse

AvatarFallback

Show the fallback content when the avatar image fails to load.

PropTypeDefault
childrenReactNodeundefined
asChildbooleanfalse