Avatar

An image element with a fallback for representing the user.

Installation

$ npx shadcn@latest add "/r/avatar.json"

Usage

CN

Sizes

Use the size prop to change the dimensions of the avatar.

CNCNCNCN

With Fallback

The AvatarFallback is shown when the image fails to load or is not provided.

JD

Props

Avatar

PropTypeDefaultDescription
size"sm" | "md" | "lg" | "xl""md"The size of the avatar.
classNamestring-Additional CSS classes to apply to the avatar.

AvatarImage

PropTypeDefaultDescription
srcstring-The source URL of the image.
altstring-The alternative text for the image.
classNamestring-Additional CSS classes to apply to the image.

AvatarFallback

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the fallback.