Skip to content

Avatar

Avatar Props ​

NameTypeDefaultDescription
srcstring-The avatar image URL.
fallbackSrcstring-Backup image URL used when the primary image fails to load.
namestring-User name. Used for initials fallback and accessible labeling.
altstring-Accessible label. Takes precedence over name.
sizeAvatarSize'md'Avatar size. Named size or numeric pixel value. See the table below for named sizes.
shapeAvatarShape'circle'Avatar shape: circle, rounded, or square.

Named sizes ​

NamePixel value
xsm20px
sm24px
md36px
lg48px
xl128px

Numeric sizes ​

The AvatarSize type lists common pixel values for type hints and autocompletion:

16 | 20 | 24 | 32 | 36 | 40 | 48 | 60 | 64 | 72 | 96 | 128 | 144 | 180

The component does not restrict you to these values. Passing any number will still render the avatar at that pixel size.

Avatar Slots ​

NameDescription
defaultCustom content that replaces the default person icon. Only used when there is no image and no name.
statusStatus indicator placed at the corner of the avatar, typically an AvatarStatusDot.

Avatar Events ​

NameDescription
errorEmitted when the primary image fails to load.

AvatarStatusDot Props ​

NameTypeDefaultDescription
variantAvatarStatusDotVariant'neutral'Status dot color variant: neutral, info, success, warning, or error.

Native attributes ​

The root element is a <span>.

The following are passed to the root element:

  • HTML attributes.
  • aria-* attributes.
  • data-* attributes.
  • class.
  • style.