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
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Change the component to the HTML tag or custom component of the only child. |
className | string | - | Additional CSS classes |
AvatarImage
| Prop | Type | Default | Description |
|---|---|---|---|
src | string | - | The source of the image. |
alt | string | - | 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
| Prop | Type | Default | Description |
|---|