Avatar
A user image with a text or icon fallback when it's missing.
Usage
Avatar represents a person or entity. Compose it from its parts, all under @appica/ui-react/avatar:
Avatar— the root that setssizeandshapeand clips its children to the rounded silhouette.AvatarImage— the photo. Base UI preloads thesrcand only swaps it in once it has loaded, so a broken or slow image never flashes.AvatarFallback— what shows until (or unless) the image loads: initials or an icon.AvatarBadge— an optional status dot in the corner.AvatarGroup— a wrapper that overlaps a row of avatars and forwards a sharedsize/shape.
The whole component is sized in em, so a single size (a preset or a pixel number) scales the image, fallback text, and status badge together.
Examples
Default
An AvatarImage with an AvatarFallback beneath it. The image is shown once loaded; until then — or if it fails — the fallback initials take its place.
Fallback
When the image is missing, still loading, or fails to load, the AvatarFallback renders instead. Use initials for people, or an icon for a generic placeholder.
Sizes
Seven presets run from 2xs to 2xl. Because the avatar is sized in em, the fallback text and status badge scale along with the image.
Custom size
Pass a number to size for an exact pixel dimension when a preset doesn't fit — say to match a specific line height. It drives the root's font-size, so everything inside still scales proportionally.
Shape
shape="circle" (the default) renders a full circle; shape="rounded" uses a squircle-style rounded square for a more app-like look.
Status badge
Drop an AvatarBadge inside the avatar for a corner status dot. Add animate for a gentle pulsing ping that draws the eye to an online indicator, and recolor it with a text-* class.
Avatar group
AvatarGroup overlaps a row of avatars and rings each one with the background color so they read as a stack. It forwards a shared size/shape to its children, and any non-image avatar — like a +5 counter — sits in the same rhythm.
Next.js Image
To serve optimized images, pass a Next.js <Image> to AvatarImage's render prop. The wrapper lifts the src so Base UI's preloader still drives the fallback, and applies its own object-cover and rounded-corner classes to the rendered <Image>. Give the Image a width/height that matches the avatar's pixel size.
Loading animation
AvatarFallback renders until the image finishes loading, so dropping a Skeleton inside it gives a shimmering placeholder that Base UI swaps for the photo automatically — no extra state needed. Press Reload to fetch a fresh copy and watch it again.
RTL
Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior follows the same direction.
The status badge moves to the start (right) corner and the group stacks from the right, because both are expressed with logical properties. For setup details and caveats, see the RTL guide.
API reference
Avatar wraps Base UI's Avatar. Each part forwards ref and its remaining attributes to the matching Base UI primitive — AvatarImage preloads src and only mounts the image once it resolves. AvatarBadge and AvatarGroup are Appica additions. See the Base UI docs for the complete API.
Avatar
The root. Renders a <span> that sizes and clips its children.
AvatarImage
The photo. Renders an <img> (or the render element) once the source has loaded.
AvatarFallback
Shown until — or unless — the image loads. Renders a <span>.
AvatarBadge
An optional status dot in the corner. Renders a <span>.
AvatarGroup
Overlaps a row of avatars and forwards a shared size/shape. Renders a <div>.
A child Avatar's own size/shape always wins over the group default.
Accessibility
- Give every meaningful
AvatarImageanaltthat names the person or entity. For a purely decorative avatar, usealt="". - The
AvatarFallbacktext (initials) is visible content, so it's announced; for an icon-only fallback, the icon is decorative — make sure the surrounding context names the user. AvatarBadgeis a visual status indicator. If the status is important, convey it in text nearby (e.g. "Online") rather than relying on the dot's color alone.- In an
AvatarGroup, each avatar keeps its own accessible name; consider anaria-labelon the group (e.g. "Project members") and visible text for any+Noverflow count. - The status badge's pulsing animation is skipped when the user prefers reduced motion.