Data & feedback@neumorphism-ui/avatar

Avatar

Built on Base UI Avatar to manage image loading and fallback transitions. Provides three sizes, a status badge, overlapping groups, and a remaining-member count.

@neumorphism-ui/avatar
Registry JSON

Preview

SMAMUI
Team
ANDESO
+9

Installation

Installation: avatarnpx shadcn@latest add @neumorphism-ui/avatar

The CLI resolves npm dependencies, base tokens, utilities, and component source in order.

New to this Registry? Set up the namespace before continuing.

Usage

Import

Avatar import code
import {
  Avatar,
  AvatarBadge,
  AvatarFallback,
  AvatarGroup,
  AvatarGroupCount,
  AvatarImage,
} from "@/components/ui/avatar"

Example

Avatar usage code
<AvatarGroup>
  <Avatar size="lg">
    <AvatarImage src="/members/ana.jpg" alt="Ana Martins" />
    <AvatarFallback>AM</AvatarFallback>
    <AvatarBadge aria-label="Online" />
  </Avatar>
  <Avatar size="lg">
    <AvatarFallback>UI</AvatarFallback>
  </Avatar>
  <AvatarGroupCount aria-label="8 more members">+8</AvatarGroupCount>
</AvatarGroup>

API Reference

ComponentPropTypeDefaultDescription
Avatarsize"sm" | "default" | "lg""default"Changes the size of the Avatar and its badge together.
AvatarImagesrcstring—The URL of the image to display.
AvatarImagealtrequiredstring—Alternative text identifying the person or subject represented by the image.
AvatarFallbackdelayMsnumber0The delay before the fallback is displayed.
AvatarBadgechildrenReact.ReactNode—Displays a status dot or small status icon.

Accessibility

  • 01

    Use the person's name as alt text for an identifying image; an empty alt is acceptable when the same name appears next to it.

  • 02

    If AvatarBadge conveys meaning such as online status, provide an aria-label or visually hidden text.

  • 03

    Add an aria-label that explains the meaning of a count such as +8 in AvatarGroupCount.