Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Shadcn Avatar for React and Tailwind

Displays a user's profile image with fallback.

VV
CN
VV
SA
PV
+2

Installation

bunx --bun shadcn@latest add https://kit.dev/r/avatar.json

Anatomy

Avatar
├── AvatarImage
└── AvatarFallback

Usage

import {
  Avatar,
  AvatarBadge,
  AvatarFallback,
  AvatarGroup,
  AvatarGroupCount,
  AvatarImage,
} from "@/components/ui/avatar";
<div className="flex flex-row flex-wrap items-center gap-6 md:gap-12">
  <Avatar>
    <AvatarImage alt="@vinihvc" src="https://github.com/vinihvc.png" />
    <AvatarFallback>VV</AvatarFallback>
  </Avatar>

  <Avatar>
    <AvatarImage alt="@shadcn" src="https://github.com/shadcn.png" />
    <AvatarFallback>CN</AvatarFallback>
    <AvatarBadge variant="success" />
  </Avatar>

  <AvatarGroup className="grayscale">
    <Avatar>
      <AvatarImage alt="@vinihvc" src="https://github.com/vinihvc.png" />
      <AvatarFallback>VV</AvatarFallback>
    </Avatar>
    <Avatar>
      <AvatarImage
        alt="@segunadebayo"
        src="https://github.com/segunadebayo.png"
      />
      <AvatarFallback>SA</AvatarFallback>
    </Avatar>
    <Avatar>
      <AvatarImage
        alt="@pasqualevitiello"
        src="https://github.com/pasqualevitiello.png"
      />
      <AvatarFallback>PV</AvatarFallback>
    </Avatar>
    <AvatarGroupCount>+2</AvatarGroupCount>
  </AvatarGroup>
</div>

Demos

Badge With Icon

Context

Custom Radius

Events

Fallback Icon

Group

Group Count

Group Count Icon

Group Popover

Hover Card

Root Provider

Size Custom

Size Lg

Size Md

Size Sm

With Status

API Reference

Avatar

div

PropType
AttributeType

AvatarImage

img

PropType
AttributeType

AvatarFallback

span

PropType
AttributeType

AvatarBadge

PropType
AttributeType

AvatarGroup

div

PropType
AttributeType

AvatarGroupCount

div

PropType
AttributeType

AvatarRootProvider

div

PropType
AttributeType

useAvatar

AvatarContext

PropType