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.
Home

Avatar

An image element with a fallback for representing a user.

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

export const AvatarDemo = () => (
    <div className="flex items-center gap-4">
      <Avatar>
        <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
        <AvatarFallback>CN</AvatarFallback>
      </Avatar>
      <Avatar>
        <AvatarImage src="https://github.com/vercel.png" alt="@vercel" />
        <AvatarFallback>VC</AvatarFallback>
      </Avatar>
      <Avatar><AvatarFallback>NS</AvatarFallback></Avatar>
    </div>
  );

With Image

Display a user's profile picture. When the image fails to load, the fallback renders automatically.

CN

Fallback Only

When no image source is provided, or the image fails to load, the fallback displays initials or any content you pass.

NSABJD

Sizes

The default size is size-8 (32px). Override with Tailwind size utilities.

CNCNCNCN

Group

Stack avatars using negative margins to create a group effect.

CNVCNS+3

Props

Avatar

PropTypeDefaultDescription
classNamestring—Additional CSS classes
childrenReactNode—AvatarImage and AvatarFallback

AvatarImage

PropTypeDefaultDescription
srcstring—Image source URL
altstring—Alt text for accessibility
classNamestring—Additional CSS classes

AvatarFallback

PropTypeDefaultDescription
delayMsnumber—Delay before showing fallback (avoids flash)
classNamestring—Additional CSS classes
childrenReactNode—Initials or icon to display

Usage

import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
 
// With image + fallback
<Avatar>
  <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
  <AvatarFallback>CN</AvatarFallback>
</Avatar>
 
// Fallback only
<Avatar>
  <AvatarFallback>NS</AvatarFallback>
</Avatar>
 
// Custom size
<Avatar className="size-12">
  <AvatarImage src={user.avatarUrl} alt={user.name} />
  <AvatarFallback>{user.initials}</AvatarFallback>
</Avatar>

Specs

# Mint — Avatar Specs
 
## Component
- name: avatar
- file: registry/mint/avatar.tsx
- installs to: components/ui/avatar.tsx
- dependencies: radix-ui
 
## What is it
A circular image container for representing a user or entity. Falls back to
initials or any ReactNode when the image is unavailable or fails to load.
Use it in navigation bars, comment threads, user lists, and anywhere a
person's identity needs a visual anchor.
 
## Visual identity
Minimal. A rounded-full container — no border, no shadow — that keeps the
focus on the image or initials. The fallback uses bg-muted with centered
text in a small font-medium weight.
 
## Design tokens
--muted: oklch(0.96 0.02 155)             — fallback background
--muted-foreground: oklch(0.52 0.06 155) — fallback text color
 
## Dark theme
--muted: oklch(0.2 0.03 155)
--muted-foreground: oklch(0.6 0.06 155)
 
## Anatomy
<Avatar>                  ← Root: rounded-full container, size-8 by default
  <AvatarImage />         ← Radix image: aspect-square size-full
  <AvatarFallback />      ← Shows when image missing/failed: flex centered, text-xs font-medium
</Avatar>
 
## States
- image loaded:  AvatarImage fills the container, AvatarFallback hidden
- image failed / no src:  AvatarFallback renders automatically
- delayMs:  pass to AvatarFallback to avoid fallback flash during fast loads
 
## Conventions
- Always include AvatarFallback — even with a known src, network errors happen
- Use 1–2 character initials in the fallback (e.g. "NS", "AB")
- For grouped avatars: add border-2 border-background and -space-x-2 on the parent
- Do not use square avatars — keep rounded-full unless explicitly redesigning
- Default size is size-8 (32px); override with Tailwind size utilities

Installation

GIN Design Plugin
$ npx shadcn add https://gin-design.vercel.app/avatar