Skip to content

Avatar ​

Avatars can be used to represent people or objects. It supports images, Icons, or characters.

Basic Usage ​

Use shape and size prop to set avatar's shape and size.

Types ​

It supports images, Icons, or characters.

Fallback ​

fallback when image load error.

Fit Container ​

Set how the image fit its container for an image avatar, same as object-fit.

API ​

Attributes ​

NameDescriptionTypeDefault
iconrepresentation type to icon, more info on icon component.string | Component—
sizeavatar size.number | enum | 'large' | 'default' | 'small'default
shapeavatar shape.enum | 'circle' | 'square'circle
srcthe source of the image for an image avatar.string—
src-setnative attribute srcset of image avatar.string—
altnative attribute alt of image avatar.string—
fitset how the image fit its container for an image avatar.'fill' | 'contain' | 'cover' | 'none' | 'scale-down'cover

Events ​

NameDescriptionType
errortrigger when image load error.(e: Event) => void

Slots ​

NameDescription
defaultcustomize avatar content.

Released under the MIT License.