Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Avatar

An image element with a fallback for representing the user.

CNL2

Installation

npx logic2b@latest add avatar

Usage

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

<Avatar>
  <AvatarImage src="https://github.com/vercel.png" alt="@logic2b" />
  <AvatarFallback>CN</AvatarFallback>
</Avatar>

API

Prop Type Default
src (AvatarImage) string — image source
alt (AvatarImage) string
onLoadingStatusChange (AvatarImage) (status: "idle" | "loading" | "loaded" | "error") => void
delayMs (AvatarFallback) number — wait before showing the fallback

Avatar, AvatarImage, and AvatarFallback also forward standard element props. Size the avatar with a className (e.g. size-12).

Examples

Group

Overlap several avatars to represent a set of users.

VCABCD+3

Fallback

When the image is missing or fails to load, the fallback is shown.

L2UI