Skip to content

Avatar Component

<Avatar /> renders an accessible initials, image, or deterministic pixel-art avatar. Images fall back to the selected avatar variant if they fail to load.

Common usage

vue
<Avatar
  name="Tony Stark"
  image-src="/tony.jpg"
  status="online"
  :size="64"
  :auto-contrast="true"
/>

Props reference

PropTypeDefaultDescription
nameStringrequiredName used for initials, generated colours, pixel art, and the accessible label.
imageSrcStringImage URL. In templates use image-src.
variant'initials' | 'pixel''initials'Selects initials or deterministic pixel art.
pixelThemeString'earth'Pixel theme: earth, neon, ocean, forest, sunset, midnight, candy, or retro.
sizeNumber40Avatar diameter in pixels.
inlineBooleanfalseDisplays the avatar inline.
shape'circle' | 'square' | 'squircle' | 'hexagon'derivedExplicit shape. Overrides rounded when set.
roundedBooleantrueLegacy circle/square switch when shape is not supplied.
color / backgroundStringgeneratedOverride the foreground or background colour.
darkBooleanfalseUses the dark generated palette.
gradientBooleanfalseUses a name-based background gradient.
autoContrastBooleanfalseUses black or white text for a hexadecimal background colour.
border / borderColorBoolean / Stringtrue / 'white'Controls the native image border; initials and pixel avatars keep their outline.
status'online' | 'away' | 'offline' | 'busy'Displays a presence indicator.
statusPositionString'bottom-right'top-right, top-left, bottom-right, or bottom-left.
sameBorderBooleanfalseMakes the status indicator use the avatar border colour.
altStringderivedAccessible label. Defaults to Avatar of {name}.
loading'lazy' | 'eager''lazy'Native image loading behaviour.
transitionBooleantrueEnables the image fade-in transition.
interactiveBooleanfalseMakes the avatar keyboard-activatable and emits activate.
pointerBooleanfalseUses a pointer cursor without making the avatar interactive.
onClickFunctionClick callback; also makes the avatar keyboard-activatable.
customAvatarStyle / customStatusStyleObject{}Inline style overrides for the avatar or status indicator.
useLegacyColorsBooleanfalseUses the legacy vue-avatar colour palette.
useTextColorForBorderBooleanfalseUses the calculated text colour as the border colour.

Events

EventPayloadWhen it fires
@errorEventThe image fails to load.
@loadEventThe image loads.
@activateEventAn interactive avatar is clicked or activated with Enter/Space.

Slots

SlotScopeDescription
image{ src, alt, size, style, class }Replace the native image, for example with NuxtImg.
placeholder{ size, style }Render a placeholder when neither name nor image-src is present.
statusReplace the visual content of the status indicator.
overlayAdd content positioned within the avatar container.

Nuxt image slot

vue
<Avatar name="Tony Stark" image-src="/tony.jpg">
  <template #image="{ src, alt, size, style }">
    <NuxtImg :src="src" :alt="alt" :width="size" :height="size" :style="style" />
  </template>
</Avatar>

Released under the MIT License.