---
title: "Integrate the Avatar UI component"
description: "Integrate a visual representation of a user or entity into your editor. Learn more in the docs."
---

> This page is for Tiptap 2.x. [See the latest version of this page.](https://tiptap.dev/docs/ui-components/primitives/avatar.md)

# Integrate the Avatar UI component

Integrate a visual representation of a user or entity into your editor. Learn more in the docs.

> **Upgrade to v3**
>
> To use UI components or templates you need to upgrade to Editor version 3.x. See the [upgrade
> guide](https://tiptap.dev/docs/resources/whats-new) for more details.

A visual representation of a user or entity, typically used in user interfaces to represent a person.

> **Interactive demo:** [avatar](https://template.tiptap.dev/preview/tiptap-ui-primitive/avatar)

## Install

You can add the primitive via Tiptap CLI (for Vite or Next.js)

```bash
npx @tiptap/cli add avatar
```

### Manual Integration

For frameworks other than Vite or Next.js, add the primitive manually from the [open-source repository](https://github.com/ueberdosis/tiptap-ui-components).

### Import styles

This component requires you to import our styles which were added to `styles/keyframe-animation.scss` and `styles/_variables.scss`.

## Usage

```tsx
import { Avatar, AvatarFallback, AvatarImage } from '@/components/tiptap-ui-primitive/avatar'

export default function MyComponent() {
  return (
    <Avatar>
      <AvatarImage src="https://via.placeholder.com/150" alt="User avatar" />
      <AvatarFallback>JD</AvatarFallback>
    </Avatar>
  )
}
```

## Avatar Group

```tsx
import {
  Avatar,
  AvatarFallback,
  AvatarGroup,
  AvatarImage,
} from '@/components/tiptap-ui-primitive/avatar'

export default function MyComponent() {
  return (
    <AvatarGroup maxVisible={3}>
      <Avatar>
        <AvatarImage src="/avatars/user1.png" alt="User 1" />
        <AvatarFallback>U1</AvatarFallback>
      </Avatar>
      <Avatar>
        <AvatarImage src="/avatars/user2.png" alt="User 2" />
        <AvatarFallback>U2</AvatarFallback>
      </Avatar>
      <Avatar>
        <AvatarImage src="/avatars/user3.png" alt="User 3" />
        <AvatarFallback>U3</AvatarFallback>
      </Avatar>
      <Avatar>
        <AvatarImage src="/avatars/user4.png" alt="User 4" />
        <AvatarFallback>U4</AvatarFallback>
      </Avatar>
    </AvatarGroup>
  )
}
```

## Props

### Avatar

| Name | Type                      | Default   | Description |
| ---- | ------------------------- | --------- | ----------- |
| size | 'default' \| 'sm' \| 'lg' | 'default' | Avatar size |

### AvatarImage

| Name | Type   | Default  | Description                         |
| ---- | ------ | -------- | ----------------------------------- |
| src  | string | required | Image source URL                    |
| alt  | string | required | Alternative text for screen readers |

### AvatarFallback

| Name    | Type   | Default | Description                                 |
| ------- | ------ | ------- | ------------------------------------------- |
| delayMs | number | 0       | Delay in ms before showing fallback content |

### AvatarGroup

| Name       | Type   | Default   | Description                                  |
| ---------- | ------ | --------- | -------------------------------------------- |
| maxVisible | number | undefined | Maximum avatars to display before collapsing |
