Avatar

An image element with a fallback for representing the user.

data-display
image
user
profile

Preview

CNJD

Code

TSX
1
2
3
4
5
6
7
8
9
10
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"

export function AvatarDemo() {
  return (
    <Avatar>
      <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
      <AvatarFallback>CN</AvatarFallback>
    </Avatar>
  )
}

API Reference

PropTypeDefaultDescription
srcstring-The image source to display.
altstring-The alt text for the avatar image.
delayMsnumber600The delay in milliseconds before showing the fallback.