Morpha UI
ComponentsData Display

Avatar

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

Overview

An avatar represents a user or entity with an image, falling back to initials when the image is unavailable. Always provide an AvatarFallback.

CN
$ npx morpha-ui add avatar

Examples

Fallback initials

MU

Group

CNABCD
+3

Installation

Morpha UI components are distributed via the Morpha CLI (coming in a later step): npx morpha-ui add avatar. In the meantime, since this is the base shadcn component, you can also add it directly:

npx shadcn@latest add avatar

API Reference

The Avatar root accepts a size prop. The parts — AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, and AvatarBadge — compose the avatar and its grouped/badged variations.

Prop

Type

Accessibility

  • Always include an AvatarFallback so something renders when the image fails to load.
  • Give AvatarImage a meaningful alt describing who or what it represents.

On this page