UI.MD

Avatar

An image element with a text fallback for representing a user or entity.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/avatar.json

Usage

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

Examples

Default

Image with a text fallback, plus an optional status dot.

MDUI
SC

Sizes

Resize with size-* utilities; bump the fallback text to match.

MDMDMDMD

Group

Overlap with -space-x-2 and a ring-background outline; cap with a +N tile.

MDSCUI+3

API Reference

PropTypeDefaultDescription
srcAvatarImagestring-Image source URL. The image only renders once it has loaded; the fallback shows until then.
onLoadingStatusChangeAvatarImage(status: "idle" | "loading" | "loaded" | "error") => void-Called when the image's loading status changes.
delayMsAvatarFallbacknumber-Delay in milliseconds before the fallback renders, avoiding a flash when the image loads quickly.