Design · Components · Display

Avatar

People as initials or images, alone or stacked in groups.

AU
TLMKJS
+3

Installation

Install the dependencies:

npm install @base-ui/react

Copy the source into components/ui/avatar.tsx. Registry items that depend on it install it automatically.

components/ui/avatar.tsx

Usage

import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";

export function Example() {
  return (
    <Avatar>
      <AvatarImage src="/avatar.png" alt="Ada" />
      <AvatarFallback>AD</AvatarFallback>
    </Avatar>
  );
}

Examples

Sizes

SMMDLG

Status badge

AvatarBadge pins a marker to the rim; give it a background to carry the status.

ONAW

API Reference

Avatar

Wraps Base UI's Avatar root.

AvatarProps
size : "sm" | "default" | "lg" = "default"

24, 32, or 40 pixels.

Parts

PartDescription
AvatarImageThe image, shown once it loads.
AvatarFallbackInitials or an icon while the image is missing.
AvatarBadgeA status marker pinned to the rim.
AvatarGroupOverlapping stack of avatars.
AvatarGroupCountOverflow count that closes a group.