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

# Avatar

> Represent a person or record with an image, initial, or icon.

export const StoryEmbed = ({storyId, title, height = 240}) => <>
    <Tabs>
      <Tab title="Light">
        <iframe title={`${title} (light)`} src={`https://storybook.twenty.com/iframe.html?id=${storyId}&viewMode=story&globals=colorScheme:light`} width="100%" height={height} loading="lazy" style={{
  border: 0
}} />
      </Tab>
      <Tab title="Dark">
        <iframe title={`${title} (dark)`} src={`https://storybook.twenty.com/iframe.html?id=${storyId}&viewMode=story&globals=colorScheme:dark`} width="100%" height={height} loading="lazy" style={{
  border: 0
}} />
      </Tab>
    </Tabs>
    <a href={`https://storybook.twenty.com/?path=/story/${storyId}`}>
      Open in Storybook
    </a>
  </>;

`Avatar` shows an image with a first-letter fallback. Use it beside a record name or inside a [Chip](/ui/primitives/data-display/chip).

<StoryEmbed storyId="ui-data-display-avatar--app" title="Avatar example" />

## Image and fallback

```tsx theme={null}
import { Avatar } from 'twenty-ui/primitives/data-display';

type PersonAvatarProps = { name: string; imageUrl?: string | null };

export const PersonAvatar = ({ name, imageUrl }: PersonAvatarProps) => (
  <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
    <Avatar src={imageUrl} name={name} shape="circle" size="lg" />
    {name}
  </span>
);
```

When the image is absent or fails to load, the fallback shows the first letter of the trimmed name in uppercase. An empty name shows `-`. `colorSeed` chooses stable fallback colors and defaults to `name`; use a record identifier to keep the color stable when the name changes.

The image and fallback are decorative. Keep the visible name beside the avatar, as above. For a standalone avatar that conveys information, supply `role="img"` and an `aria-label`.

## Shape and appearance

`shape` accepts `square`, `rounded-square`, or `circle`. Sizes run from `xs` (12px) to `xl` (40px); `md` is 16px. `variant="outline"` adds a border to the fallback. The `color`, `backgroundColor`, and `borderColor` overrides customize the fallback, while a loaded image keeps its original appearance.

```tsx theme={null}
import { IconUser } from 'twenty-ui/icon';
import { Avatar } from 'twenty-ui/primitives/data-display';

export const ContactIcon = () => (
  <Avatar
    icon={<IconUser />}
    shape="rounded-square"
    size="xl"
    role="img"
    aria-label="Contact"
  />
);
```

An `icon` takes precedence over both the image and the first-letter fallback. `pulsing` animates opacity and respects reduced-motion preferences.

## Open a profile

```tsx theme={null}
import { Avatar } from 'twenty-ui/primitives/data-display';

type ProfileAvatarProps = { onOpenProfile: () => void };

export const ProfileAvatar = ({ onOpenProfile }: ProfileAvatarProps) => (
  <Avatar
    name="Jane"
    shape="circle"
    size="lg"
    aria-label="Open Jane's profile"
    onClick={onOpenProfile}
  />
);
```

Supplying `onClick` renders a button with pointer, Enter, and Space activation. Use `disabled` to prevent activation. The default accessible name comes from `name`, but an action-specific `aria-label` makes the purpose clearer. When replacing the button through `render`, set `nativeButton={false}` for a non-button element.

## Props

Types and defaults are generated from the public component types. Native attributes and event handlers are also accepted.

<ParamField body="backgroundColor" type="string">
  Background color override for a first-letter fallback.
</ParamField>

<ParamField body="borderColor" type="string">
  Border color override for the outline fallback.
</ParamField>

<ParamField body="className" type="string | ((state: AvatarRootState) => string | undefined)">
  CSS class applied to the element, or a function that
  returns a class based on the component's state.
</ParamField>

<ParamField body="color" type="string">
  Text color override for a first-letter fallback.
</ParamField>

<ParamField body="colorSeed" type="string">
  Stable value used to choose fallback colors. Defaults to `name`.
</ParamField>

<ParamField body="disabled" type="boolean" default="false">
  Applies disabled styling and disables activation when `onClick` is supplied.
</ParamField>

<ParamField body="icon" type="ReactNode">
  Icon rendered instead of the image and first-letter fallback.
</ParamField>

<ParamField body="name" type="string">
  Name used for the first-letter fallback and the default accessible name when clickable.
</ParamField>

<ParamField body="nativeButton" type="boolean" default="true">
  Set to `false` when a clickable avatar uses `render` with an element other than a native button.
</ParamField>

<ParamField body="pulsing" type="boolean" default="false">
  Animates the avatar opacity. Respects reduced-motion preferences.
</ParamField>

<ParamField body="render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, AvatarRootState>">
  Allows you to replace the component's HTML element
  with a different tag, or compose it with another component.

  Accepts a `ReactElement` or a function that returns the element to render.
</ParamField>

<ParamField body="shape" type="&#x22;circle&#x22; | &#x22;square&#x22; | &#x22;rounded-square&#x22;" default="square">
  Shape of the avatar and its fallback.
</ParamField>

<ParamField body="size" type="&#x22;sm&#x22; | &#x22;md&#x22; | &#x22;lg&#x22; | &#x22;xl&#x22; | &#x22;xs&#x22;" default="md">
  Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), or `xl` (40px).
</ParamField>

<ParamField body="src" type="string | null">
  Image URL. A missing or failed image shows the fallback.
</ParamField>

<ParamField body="style" type="CSSProperties | ((state: AvatarRootState) => CSSProperties | undefined)">
  Style applied to the element, or a function that
  returns a style object based on the component's state.
</ParamField>

<ParamField body="variant" type="&#x22;outline&#x22; | &#x22;soft&#x22;" default="soft">
  Visual treatment of the fallback.
</ParamField>
