Search

Search documentation

Avatar

An image element with a fallback for representing the user.

Installation

pnpm dlx shadcn@latest add @evolphin/avatar

Usage

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

Type Definitions

interface AvatarProps {
  /** Used to force mounting when more control is needed */
  ?: boolean;
}

Examples

Default

CN

Fallback

CN

API Reference

Avatar

PropTypeDefaultDescription
asChildbooleanfalseChange the component to the HTML tag or custom component of the only child.
classNamestring-Additional CSS classes

AvatarImage

PropTypeDefaultDescription
srcstring-The source of the image.
altstring-The alternative text of the image.
onLoadingStatusChange(status: "idle" | "loading" | "loaded" | "error") => void-A callback providing information about the loading status of the image.

AvatarFallback

PropTypeDefaultDescription

On this page