For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
43
Sponsor

Avatar

An image element with a fallback for representing the user.

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

Installation

$ pnpm dlx shadcn@latest add https://shadcn-cssinjs.com/r/avatar.json

Usage

import {
  Avatar,
  AvatarFallback,
  AvatarImage,
} from "@/components/ui/avatar/avatar";
<Avatar>
  <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
  <AvatarFallback>CN</AvatarFallback>
</Avatar>

Composition

Use the following composition to build a Avatar:

Avatar
├── AvatarImage
└── AvatarFallback

Examples

Basic

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

Badge

Use AvatarBadge to display a status indicator.

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

Badge with Icon

PP
import { PlusIcon } from "lucide-react";

import {
  Avatar,
  AvatarBadge,
  AvatarFallback,

Avatar Group

Use AvatarGroup to display overlapping avatars.

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

Avatar Group Count

Use AvatarGroupCount to display a count of additional members.

CNLRER
+3
import {
  Avatar,
  AvatarFallback,
  AvatarGroup,
  AvatarGroupCount,
  AvatarImage,

Avatar Group with Icon

CNLRER
import { PlusIcon } from "lucide-react";

import {
  Avatar,
  AvatarFallback,
  AvatarGroup,

Sizes

Use the size prop to change the avatar size.

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

import {
  Avatar,
  AvatarFallback,
  AvatarImage,

RTL

To enable right-to-left support, see the RTL guide.

CNAP
"use client";

import { useTranslation } from "@/components/language-selector";
import type { Translations } from "@/components/language-selector";
import {
  Avatar,

API Reference

See the Base UI documentation for the full API.