Avatar

Data display

A person's picture or initials: <Avatar.Root> (size sm, default, lg) holds an Avatar.Image (src, alt) and an Avatar.Fallback shown while it loads or when it fails. Avatar.Badge marks a status; Avatar.Group overlaps several, with an Avatar.GroupCount for the rest.

import { Avatar } from '@limerdev/zest';
Avatar for AI tools (llms.txt)
Use for
Showing who: the person signed in, a row's owner, the people on a project.
Don't
An avatar as a person's only name: show the name too, or give the image alt. Decorative pictures: use a plain <img>.

Examples

Basic

Initials show until the picture loads, or when it can't.

AB
AB
EL

Group

A group overlaps avatars; GroupCount stands in for the rest.

AB
EL
MK
SJ
+8

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

Avatar.Root

Prop Type Default Description
delayMs number 0 The delay in milliseconds to wait before showing the avatar once the image has loaded. This can be used to prevent sudden flickering of the image if it loads quickly.
loadingStatus bindable "error" | "loading" | "loaded" 'loading' The loading status of the image. If you are confident that the image exists and will load successfully, you can set this to "loaded" to skip the loading process (which shows the fallback) and immediately show the image.
onLoadingStatusChange OnChangeFn<AvatarImageLoadingStatus> – A callback invoked when the loading status of the image changes.
size "default" | "sm" | "lg" 'default' The avatar's size: sm (24px), default (32px) or lg (40px).

Avatar.Image

No props of its own beyond the common ones.

Avatar.Fallback

No props of its own beyond the common ones.

Avatar.Badge

No props of its own beyond the common ones.

Avatar.Group

No props of its own beyond the common ones.

Avatar.GroupCount

No props of its own beyond the common ones.