Skip to content

Avatar ​

An image element with a fallback for representing the user. The initials show while loading, without a source, and when the image fails to load.

Usage ​

Approximate web preview — the HarmonyOS rendering is the reference.

Sizes ​

sizing: vp, or 'xs' | 'sm' | 'default' | 'md' | 'lg' | 'xl'.

Approximate web preview — the HarmonyOS rendering is the reference.

Shapes & status ​

shape: circle | rounded | square; status: online | away | busy | offline.

Approximate web preview — the HarmonyOS rendering is the reference.

Group ​

SAvatarGroup overlaps avatars with a background ring and adds "+N".

Approximate web preview — the HarmonyOS rendering is the reference.

API ​

Extracted from the @Param / @Event / @BuilderParam declarations in the library sources.

SAvatar ​

shadcn-vue Avatar (+ AvatarImage / AvatarFallback): relative flex size-8 shrink-0 overflow-hidden rounded-full. The fallback (initials on bg-muted) shows while the image loads, when src is missing, and when loading fails.

Variants: sizing (vp or xs | sm | default | md | lg | xl), shape (circle | rounded | square), status (presence dot: online | away | busy | offline) and ring (a 2vp background-coloured ring, for overlapping).

PropTypeDefaultDescription
srcResourceStr | undefinedundefined
fallbackstring''Initials shown when there is no image.
sizingnumber | AvatarSize
AvatarSize = 'xs' | 'sm' | 'default' | 'md' | 'lg' | 'xl'
32Diameter in vp (size-8 = 32) or a named size.
shapeAvatarShape
AvatarShape = 'circle' | 'rounded' | 'square'
'circle'
statusAvatarStatus | undefined
AvatarStatus = 'online' | 'away' | 'busy' | 'offline'
undefinedPresence dot at the bottom-right.
ringbooleanfalse2vp ring in the background colour (ring-2 ring-background).
labelstring | undefinedundefinedAccessible name; defaults to fallback.

SAvatarGroup ​

Overlapping avatar stack (shadcn's flex -space-x-2 *:ring-2 *:ring-background pattern) with a "+N" bubble. Data-driven, because a slot's children cannot be restyled: pass the initials and (optionally) the images.

PropTypeDefaultDescription
fallbacksstring[][]Initials of each avatar (one avatar per entry).
sourcesResourceStr[][]Image of each avatar, by index (optional, may be shorter).
maxnumber0Avatars shown before the "+N" bubble; 0 = all.
extranumber0Additional count not in the lists (e.g. total from a server), added to the "+N" bubble.
sizingnumber | AvatarSize
AvatarSize = 'xs' | 'sm' | 'default' | 'md' | 'lg' | 'xl'
32
shapeAvatarShape
AvatarShape = 'circle' | 'rounded' | 'square'
'circle'
overlapnumber | undefinedundefinedOverlap in vp; defaults to a quarter of the diameter (-space-x-2 at 32vp).
labelstring | undefinedundefinedAccessible name of the group.

MIT Licensed