Skip to content

Avatar

An image element with a fallback for representing the user.

MD

Install

Bash
npx @madeui/cli add avatar

Usage

TSX
import {
  Avatar,
  AvatarBadge,
  AvatarFallback,
  AvatarGroup,
  AvatarGroupCount,
  AvatarImage,
} from '@/components/ui/avatar';

Composition

TSX
<Avatar>
  <AvatarImage />
  <AvatarFallback />
  <AvatarBadge />
</Avatar>

Sizes

SMMDLG

Fallback

The fallback renders while the image loads — or when it fails. Always provide one.

UI

Badge

AvatarBadge anchors a status indicator to the bottom-right corner. Pass a small icon as children for something other than a plain dot.

MD
GH

Group

AvatarGroup overlaps its children with a colors.background ring separating each one.

MDGHVC

Group count

Add an AvatarGroupCount as the last child to show a “+N” overflow indicator.

MDGH+3

API reference

Built on Base UI Avatar. The tables below cover the props this library adds or changes — every other prop is forwarded to the underlying Base UI part; see the Base UI Avatar API reference for the full list.

Avatar

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''md'
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles.

AvatarGroupCount

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''md'Matches the size of the avatars in the group.
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles.

Styling

AvatarImage, AvatarFallback, AvatarBadge, AvatarGroup accept style (StyleXStyles, merged last so caller overrides always win) plus all native props of the element they render.

Was this page helpful?