> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devreadykit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Avatar

> Display user profile pictures, initials, or icons with customizable sizes and status badges

export const AvatarTeamMembersExamplePreview = () => <iframe src="https://kerny-custom.vercel.app/preview/AvatarTeamMembersExample" frameBorder="0" width="100%" height="240"></iframe>;

export const AvatarUserListExamplePreview = () => <iframe src="https://kerny-custom.vercel.app/preview/AvatarUserListExample" frameBorder="0" width="100%" height="360"></iframe>;

export const AvatarStatusBadgesExample = () => <iframe src="https://kerny-custom.vercel.app/preview/AvatarStatusBadges" frameBorder="0" width="100%" height="260"></iframe>;

export const AvatarSizesExample = () => <iframe src="https://kerny-custom.vercel.app/preview/AvatarSizes" frameBorder="0" width="100%" height="260"></iframe>;

export const AvatarIconExample = () => <iframe src="https://kerny-custom.vercel.app/preview/AvatarIconExamples" frameBorder="0" width="100%" height="260"></iframe>;

export const AvatarInitialsExample = () => <iframe src="https://kerny-custom.vercel.app/preview/AvatarInitials" frameBorder="0" width="100%" height="280"></iframe>;

export const AvatarImageFallbackExample = () => <iframe src="https://kerny-custom.vercel.app/preview/AvatarImageFallback" frameBorder="0" width="100%" height="320"></iframe>;

export const AvatarBasicExample = () => <iframe src="https://kerny-custom.vercel.app/preview/AvatarBasic" frameBorder="0" width="100%" height="320"></iframe>;

## Overview

The UserBold component displays user profile images, initials, or icons with support for different sizes and status indicators.

## Basic Usage

<Tabs>
  <Tab title="Code">
    ```tsx theme={null}
    import { Avatar } from '@peppermint-design/devreadykit-custom';

    export default function App() {
      return (
        <div className="flex items-center gap-4">
            <Avatar
                src="https://i.pravatar.cc/100?img=48"
                alt="John Doe"
                name="John Doe"
                size="xs"
            />
            <Avatar
                src="https://i.pravatar.cc/100?img=32"
                alt="Jane Smith"
                name="Jane Smith"
                size="sm"
            />
            <Avatar
                src="https://i.pravatar.cc/100?img=12"
                alt="Jane Smith"
                name="Jane Smith"
                size="md"
            />
            <Avatar
                src="https://i.pravatar.cc/100?img=18"
                alt="Jane Smith"
                name="Jane Smith"
                size="lg"
            />
        </div>
      );
    }
    ```
  </Tab>

  <Tab title="Preview">
    <AvatarBasicExample />
  </Tab>
</Tabs>

### Fallback to Initials

When the image fails to load, it automatically falls back to initials.

<Tabs>
  <Tab title="Code">
    ```tsx theme={null}
    import Avatar from "@peppermint-design/devreadykit-custom";

    export default function AvatarImageFallback() {
      return (
        <div className="flex items-center gap-4">
          <Avatar
            src="https://example.com/missing-image.jpg"
            alt="Missing Image"
            name="John Doe"
          />
        </div>
      );
    }

    ```
  </Tab>

  <Tab title="Preview">
    <AvatarImageFallbackExample />
  </Tab>
</Tabs>

## Initials Avatars

### With Name

The component automatically generates initials from the name.

<Tabs>
  <Tab title="Code">
    ```tsx theme={null}
    import Avatar from "@peppermint-design/devreadykit-custom";

    export default function AvatarInitials() {
        return (
            <div className="flex items-center gap-4">
                <Avatar name="John Doe" size="xs" />
                <Avatar name="Jane Smith" size="sm" />
                <Avatar initials="AB" size="md" />
            </div>
        );
    }

    ```
  </Tab>

  <Tab title="Preview">
    <AvatarInitialsExample />
  </Tab>
</Tabs>

## Icon Avatars

<Tabs>
  <Tab title="Code">
    ```tsx theme={null}
    import Avatar from "@peppermint-design/devreadykit-custom";
    import { User } from "@/assets/icons/user";

    export default function AvatarIconExamples() {
      return (
        <div className="flex items-center gap-4">
          <Avatar size="xs" icon={<User />} />
          <Avatar size="sm" icon={<User />} />
          <Avatar size="md" icon={<User />} />
          <Avatar size="lg" icon={<User />} />
        </div>
      );
    }

    ```
  </Tab>

  <Tab title="Preview">
    <AvatarIconExample />
  </Tab>
</Tabs>

## Sizes

Avatars support four fixed sizes. The default size token is `sm` (40px).

<Tabs>
  <Tab title="Code">
    ```tsx theme={null}
    <Avatar name="John Doe" size="xs" />
    <Avatar name="John Doe" size="sm" />
    <Avatar name="John Doe" size="md" />
    <Avatar name="John Doe" size="lg" />
    ```
  </Tab>

  <Tab title="Preview">
    <AvatarSizesExample />
  </Tab>
</Tabs>

## Status Badges

### With Status Badge

<Tabs>
  <Tab title="Code">
    ```tsx theme={null}
    import Avatar from "@peppermint-design/devreadykit-custom";

    export default function AvatarStatusBadges() {
      return (
        <div className="flex items-center gap-6">
          <Avatar name="John Doe" size="xs" showBadge badgeVariant="dot" />
          <Avatar name="Jane Smith" size="sm" showBadge badgeVariant="icon" />
          <Avatar name="Jane Smith" size="md" showBadge badgeVariant="icon" />
          <Avatar name="Jane Smith" size="lg" showBadge badgeVariant="icon" />
        </div>
      );
    }

    ```
  </Tab>

  <Tab title="Preview">
    <AvatarStatusBadgesExample />
  </Tab>
</Tabs>

## Props

| Prop           | Type                           | Default  | Description            |
| :------------- | :----------------------------- | :------- | :--------------------- |
| size           | `"xs" \| "sm" \| "md" \| "lg"` | `"sm"`   | Avatar size token      |
| src            | `string`                       | —        | Image source URL       |
| alt            | `string`                       | —        | Alt text for image     |
| name           | `string`                       | —        | User name for initials |
| initials       | `string`                       | —        | Custom initials        |
| icon           | `React.ReactNode`              | —        | Icon to display        |
| showBadge      | `boolean`                      | `false`  | Show status badge      |
| badgeIcon      | `React.ReactNode`              | —        | Badge icon             |
| badgeVariant   | `"auto" \| "dot" \| "icon"`    | `"auto"` | Badge style            |
| badgeClassName | `string`                       | —        | Custom badge classes   |
| className      | `string`                       | —        | Additional CSS classes |

## Examples

### User List

<Tabs>
  <Tab title="Code">
    ```tsx theme={null}
    import Avatar from "@peppermint-design/devreadykit-custom";

    const users = [
        {
            id: 1,
            name: "John Doe",
            avatar: "https://i.pravatar.cc/100?img=12",
            isOnline: true,
        },
        {
            id: 2,
            name: "Jane Smith",
            avatar: "https://i.pravatar.cc/100?img=18",
            isOnline: false,
        },
        {
            id: 3,
            name: "Alex Johnson",
            avatar: "https://i.pravatar.cc/100?img=28",
            isOnline: true,
        },
    ];

    export default function AvatarUserListExample() {
        return (
            <div className="space-y-3">
                {users.map((user) => (
                    <div key={user.id} className="flex items-center gap-3">
                        <Avatar
                            src={user.avatar}
                            name={user.name}
                            size="md"
                            showBadge={user.isOnline}
                        />
                        <span className="text-sm text-neutral-700">{user.name}</span>
                    </div>
                ))}
            </div>
        );
    }
    ```
  </Tab>

  <Tab title="Preview">
    <AvatarUserListExamplePreview />
  </Tab>
</Tabs>

### Team Members

<Tabs>
  <Tab title="Code">
    ```tsx theme={null}
    import Avatar from "@peppermint-design/devreadykit-custom";

    const members = [
    { id: 1, name: "John", avatar: "https://i.pravatar.cc/100?img=15" },
    { id: 2, name: "Jane", avatar: "https://i.pravatar.cc/100?img=47" },
    { id: 3, name: "Alex", avatar: "https://i.pravatar.cc/100?img=20" },
    { id: 4, name: "Maria", avatar: "https://i.pravatar.cc/100?img=33" },
    { id: 5, name: "Chris", avatar: "https://i.pravatar.cc/100?img=7" },
    { id: 6, name: "Taylor", avatar: "https://i.pravatar.cc/100?img=52" },
    ];

    export default function AvatarTeamMembersExample() {
      return (
        <div className="flex items-center">
          {members.slice(0, 5).map((member, index) => (
            <Avatar
              key={member.id}
              src={member.avatar}
              name={member.name}
              size="sm"
              className="border-2 border-white -ml-2 first:ml-0"
              style={{ zIndex: members.length - index }}
            />
          ))}
          {members.length > 5 && (
            <div className="ml-2 flex h-8 w-8 items-center justify-center rounded-full bg-gray-200 text-sm font-medium text-neutral-600">
              +{members.length - 5}
            </div>
          )}
        </div>
      );
    }

    ```
  </Tab>

  <Tab title="Preview">
    <AvatarTeamMembersExamplePreview />
  </Tab>
</Tabs>

```
```
