Usage
Wrap multiple Avatar within an AvatarGroup to stack them.
<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
Use the size prop to change the size of all the avatars.
<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
Use the max prop to limit the number of avatars displayed. The rest is displayed as an +X avatar.
<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 Soon
Use the color prop to change the color of all the avatars.
<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>
Examples
With tooltip
Wrap each avatar with a Tooltip to display a tooltip on hover.
With chip
Wrap each avatar with a Chip to display a chip around the avatar.
With link
Wrap each avatar with a Link to make them clickable.
With mask
Wrap an avatar with a CSS mask to display it with a custom shape.
The
chip prop does not work correctly when using a mask. Chips may be cut depending on the mask shape.API
Props
Slots
Theme
https://github.com/bitrix24/b24ui/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'
}
}