v2.15.0

AvatarGroup

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

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

Несколько аватаров, помещённых в AvatarGroup, складываются в стопку.

Employee NameBitrix24Assistant Name
<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 меняет размер всех аватаров.

Employee NameBitrix24Assistant Name
<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.

Employee NameBitrix24+1
<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 меняет цвет всех аватаров.

Employee NameBitrix24Assistant Name
<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, чтобы показывать подсказку при наведении.

Имя помощникаBitrix24Имя сотрудника
<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, чтобы показать чип рядом с аватаром.

Имя помощникаBitrix24Имя сотрудника
<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, чтобы по нему можно было кликнуть.

Имя помощникаBitrix24Имя сотрудника
<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-маска придаёт аватару нестандартную форму.

Имя помощникаBitrix24Имя сотрудника
<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>
С маской пропс chip работает некорректно: в зависимости от формы маски чип может обрезаться.

API

Пропсы

Prop Default Type
as'div'any

The element or component this component should render as.

size'md' "md" | "3xs" | "2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "3xl"
color'air-secondary-no-accent'"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"
max string | number

The maximum number of avatars to display.

b24ui { root?: SlotClass; base?: SlotClass; }

Слоты

Slot Type
default{}

Тема

https://github.com/bx-shef/b24-ui/tree/main/src/theme/avatar-group.ts
export default {
  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'
  }
}