Dinachi

Avatar

An image element with a fallback for representing a user. Supports multiple sizes and graceful loading states.

#Installation

npx @dinachi/cli@latest add avatar

#Usage

tsx
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar'

#Examples

Default Avatar

A basic avatar with image and fallback

CN

Avatar Sizes

Different avatar sizes

SML

#API Reference

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''md'The size of the avatar
srcstringThe image source URL for the avatar
altstringAlternative text for the avatar image
fallbackReact.ReactNodeContent to display when the image fails to load or is not provided