Display

Avatar

User avatar with image, initials, or icon fallback.

Available inreactangular

Preview

Live previewreal component
Anthropic
MCP
MB

Install

TerminalBash
npx mcp-elements add avatar

Usage

avatar-example.tsxTSX
import { Avatar } from '@mcp-elements/react'

export function Example() {
  return (
    <div className="flex items-center gap-3">
      <Avatar src="https://github.com/anthropics.png" alt="Anthropic" fallback="AN" />
      <Avatar fallback="MB" />
    </div>
  )
}

Props

PropTypeDefaultDescription
srcstringImage URL; falls back to `fallback` text if it fails to load
altstringAlt text for the avatar image
fallbackstringText (usually initials) shown when there is no image or it fails to load
classNamestringAdditional CSS classes