Avatar

Round user image with an initials fallback in three sizes, plus an optional status badge and a stacked group.

Installation

pnpm dlx shadcn@latest add @ward/avatar

Add the Ward registry to components.json once:

"registries": {
  "@ward": "https://ward.so/r/{name}.json"
}

Or install from the URL with no configuration: npx shadcn@latest add https://ward.so/r/avatar.json

Usage

import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "@/components/ui/avatar";
<Avatar>
  <AvatarImage src="/ada.jpg" alt="Ada Lovelace" />
  <AvatarFallback>AL</AvatarFallback>
  <AvatarBadge />
</Avatar>

<AvatarGroup>
  <Avatar size="sm"><AvatarFallback>AL</AvatarFallback></Avatar>
  <Avatar size="sm"><AvatarFallback>GH</AvatarFallback></Avatar>
  <AvatarGroupCount>+3</AvatarGroupCount>
</AvatarGroup>

Props

PropTypeDefaultDescription
size"default" | "sm" | "lg""default"Diameter of the avatar; its badge scales with it.
AvatarImage srcstring-Image address; the fallback shows while it loads or if it fails.
AvatarImage altstring-Text alternative for the image.
AvatarFallback delayMsnumber-Wait this many milliseconds before showing the fallback, to avoid a flash for fast images.
AvatarBadge childrenReactNode-Optional icon inside the status dot; it is hidden on the small size.

Ward · Version 1.0.0 · Registry manifest