---
title: "AvatarGroup"
description: "Складывает несколько аватаров в одну группу."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/avatar-group"
---
# AvatarGroup

> Складывает несколько аватаров в одну группу.

## Использование

Несколько [аватаров](https://b24-ui.bx-shef.by/raw/docs/components/avatar.md), помещённых в AvatarGroup, складываются в стопку.

```vue
<template>
  <B24AvatarGroup>
<B24Avatar src="/b24ui/avatar/employee.png" alt="Employee Name" />
<B24Avatar src="https://github.com/bitrix24.png" alt="Bitrix24" />
<B24Avatar src="/b24ui/avatar/assistant.png" alt="Assistant Name" />
</B24AvatarGroup>
</template>
```

### Размер

Пропс `size` меняет размер всех аватаров.

```vue
<template>
  <B24AvatarGroup size="xl">
<B24Avatar src="/b24ui/avatar/employee.png" alt="Employee Name" loading="lazy" />
<B24Avatar src="https://github.com/bitrix24.png" alt="Bitrix24" loading="lazy" />
<B24Avatar src="/b24ui/avatar/assistant.png" alt="Assistant Name" loading="lazy" />
</B24AvatarGroup>
</template>
```

### Максимум

Пропс `max` ограничивает число видимых аватаров, остальные сворачиваются в аватар `+X`.

```vue
<template>
  <B24AvatarGroup :max="2">
<B24Avatar src="/b24ui/avatar/employee.png" alt="Employee Name" loading="lazy" />
<B24Avatar src="https://github.com/bitrix24.png" alt="Bitrix24" loading="lazy" />
<B24Avatar src="/b24ui/avatar/assistant.png" alt="Assistant Name" loading="lazy" />
</B24AvatarGroup>
</template>
```

### Цвет

Пропс `color` меняет цвет всех аватаров.

```vue
<template>
  <B24AvatarGroup color="air-boost">
<B24Avatar src="/b24ui/avatar/employee.png" alt="Employee Name" loading="lazy" />
<B24Avatar src="https://github.com/bitrix24.png" alt="Bitrix24" loading="lazy" />
<B24Avatar src="/b24ui/avatar/assistant.png" alt="Assistant Name" loading="lazy" />
</B24AvatarGroup>
</template>
```

## Примеры

### С подсказкой

Оберните каждый аватар в [Tooltip](https://b24-ui.bx-shef.by/raw/docs/components/tooltip.md), чтобы показывать подсказку при наведении.

```vue [AvatarGroupTooltipExample.vue]
<template>
  <B24AvatarGroup size="xl">
    <B24Tooltip text="Имя помощника">
      <B24Avatar
        src="/b24ui/avatar/assistant.png"
        alt="Имя помощника"
        loading="lazy"
      />
    </B24Tooltip>

    <B24Tooltip text="Bitrix24">
      <B24Avatar
        src="https://github.com/bitrix24.png"
        alt="Bitrix24"
        loading="lazy"
      />
    </B24Tooltip>

    <B24Tooltip text="Имя сотрудника">
      <B24Avatar
        src="/b24ui/avatar/employee.png"
        alt="Имя сотрудника"
        loading="lazy"
      />
    </B24Tooltip>
  </B24AvatarGroup>
</template>
```

### С чипом

Оберните каждый аватар в [Chip](https://b24-ui.bx-shef.by/raw/docs/components/chip.md), чтобы показать чип рядом с аватаром.

```vue [AvatarGroupChipExample.vue]
<template>
  <B24AvatarGroup size="xl">
    <B24Avatar
      src="/b24ui/avatar/assistant.png"
      alt="Имя помощника"
      loading="lazy"
      :chip="{ inset: true, color: 'air-primary-success', position: 'top-left' }"
    />

    <B24Avatar
      src="https://github.com/bitrix24.png"
      alt="Bitrix24"
      loading="lazy"
      :chip="{ inset: true, color: 'air-primary-warning', position: 'top-left' }"
    />

    <B24Avatar
      src="/b24ui/avatar/employee.png"
      alt="Имя сотрудника"
      loading="lazy"
      :chip="{ inset: true, color: 'air-primary-alert' }"
    />
  </B24AvatarGroup>
</template>
```

### Со ссылкой

Оберните каждый аватар в [Link](https://b24-ui.bx-shef.by/raw/docs/components/link.md), чтобы по нему можно было кликнуть.

```vue [AvatarGroupLinkExample.vue]
<template>
  <B24AvatarGroup size="xl">
    <B24Link
      to="https://github.com/bitrix24/b24ui"
      target="_blank"
      class="hover:ring-3 hover:ring-blue-500 transition"
      raw
    >
      <B24Avatar
        src="/b24ui/avatar/assistant.png"
        alt="Имя помощника"
        loading="lazy"
      />
    </B24Link>

    <B24Link
      to="https://apidocs.bitrix24.com/"
      target="_blank"
      class="hover:ring-3 hover:ring-ai-500 transition"
      raw
    >
      <B24Avatar
        src="https://github.com/bitrix24.png"
        alt="Bitrix24"
        loading="lazy"
      />
    </B24Link>

    <B24Link
      to="https://github.com/bitrix24/b24ui"
      target="_blank"
      class="hover:ring-3 hover:ring-collab-500 transition"
      raw
    >
      <B24Avatar
        src="/b24ui/avatar/employee.png"
        alt="Имя сотрудника"
        loading="lazy"
      />
    </B24Link>
  </B24AvatarGroup>
</template>
```

### С маской

CSS-маска придаёт аватару нестандартную форму.

```vue [AvatarGroupMaskExample.vue]
<template>
  <B24AvatarGroup
    size="xl"
    :b24ui="{
      base: 'bg-(--ui-color-green-35) ring-(--ui-color-green-55)'
    }"
  >
    <B24Avatar
      src="/b24ui/avatar/assistant.png"
      alt="Имя помощника"
      loading="lazy"
      class="rounded-none squircle"
    />

    <B24Avatar
      src="https://github.com/bitrix24.png"
      alt="Bitrix24"
      loading="lazy"
    />

    <B24Avatar
      src="/b24ui/avatar/employee.png"
      alt="Имя сотрудника"
      loading="lazy"
      class="rounded-none squircle"
    />
  </B24AvatarGroup>
</template>

<style>
.squircle {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M8.65 20H6q-.825 0-1.412-.587T4 18v-2.65L2.075 13.4q-.275-.3-.425-.662T1.5 12t.15-.737t.425-.663L4 8.65V6q0-.825.588-1.412T6 4h2.65l1.95-1.925q.3-.275.663-.425T12 1.5t.738.15t.662.425L15.35 4H18q.825 0 1.413.588T20 6v2.65l1.925 1.95q.275.3.425.663t.15.737t-.15.738t-.425.662L20 15.35V18q0 .825-.587 1.413T18 20h-2.65l-1.95 1.925q-.3.275-.662.425T12 22.5t-.737-.15t-.663-.425z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
}
</style>
```

> [!WARNING]
> С маской пропс `chip` работает некорректно: в зависимости от формы маски чип может обрезаться.

## API

### Пропсы

```ts
/**
 * Props for the AvatarGroup component
 */
interface AvatarGroupProps {
  /**
   * The element or component this component should render as.
   * @default 'div'
   */
  as?: any;
  /**
   * @default 'md'
   */
  size?: "md" | "3xs" | "2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "3xl" | undefined;
  /**
   * @default 'air-secondary-no-accent'
   */
  color?: "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-warning" | "air-primary-copilot" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost" | "air-primary-no-accent";
  /**
   * The maximum number of avatars to display.
   */
  max?: string | number | undefined;
  b24ui?: { root?: SlotClass; base?: SlotClass; } | undefined;
}
```

### Слоты

```ts
/**
 * Slots for the AvatarGroup component
 */
interface AvatarGroupSlots {
  default(): any;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    avatarGroup: {
      slots: {
        root: 'inline-flex justify-end',
        base: 'relative rounded-full last:me-0'
      },
      variants: {
        size: {
          '3xs': {
            base: '-me-0.5'
          },
          '2xs': {
            base: '-me-0.5'
          },
          xs: {
            base: '-me-0.5'
          },
          sm: {
            base: '-me-1.5'
          },
          md: {
            base: '-me-1.5'
          },
          lg: {
            base: '-me-1.5'
          },
          xl: {
            base: '-me-2'
          },
          '2xl': {
            base: '-me-2'
          },
          '3xl': {
            base: '-me-2'
          }
        },
        color: {
          'air-primary': '',
          'air-primary-success': '',
          'air-primary-alert': '',
          'air-primary-copilot': '',
          'air-primary-warning': '',
          'air-primary-no-accent': '',
          'air-secondary': '',
          'air-secondary-alert': '',
          'air-secondary-accent': '',
          'air-secondary-accent-1': '',
          'air-secondary-accent-2': '',
          'air-secondary-no-accent': '',
          'air-tertiary': '',
          'air-tertiary-accent': '',
          'air-tertiary-no-accent': '',
          'air-selection': '',
          'air-boost': ''
        }
      },
      defaultVariants: {
        size: 'md',
        color: 'air-secondary-no-accent'
      }
    }
  }
})
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
