Использование
Имя
Пропс name показывает имя пользователя.
Иван Петров
<template>
<B24User name="Иван Петров" />
</template>
Описание
Пропс description показывает описание пользователя.
Иван Петров
Инженер-программист
<template>
<B24User name="Иван Петров" description="Инженер-программист" />
</template>
Аватар
Пропс avatar показывает компонент Avatar.
Иван Петров
Инженер-программист
<template>
<B24User
name="Иван Петров"
description="Инженер-программист"
:avatar="{
src: '/b24ui/avatar/employee.png',
loading: 'lazy'
}"
/>
</template>
Цвет
Пропс color тонирует вложенный Avatar. Значение avatar.color, отличное от undefined, переопределяет его.
Иван Петров
Инженер-программист
<template>
<B24User
name="Иван Петров"
description="Инженер-программист"
:avatar="{
src: '/b24ui/avatar/employee.png'
}"
color="air-primary-alert"
/>
</template>
Чип
Пропс chip показывает компонент Chip.
Иван Петров
Инженер-программист
<template>
<B24User
name="Иван Петров"
description="Инженер-программист"
:avatar="{
src: '/b24ui/avatar/employee.png'
}"
:chip="{
color: 'primary',
position: 'top-right'
}"
/>
</template>
Размер
Пропс size меняет размер аватара и текста пользователя.
Иван Петров
Инженер-программист
<template>
<B24User
name="Иван Петров"
description="Инженер-программист"
:avatar="{
src: '/b24ui/avatar/employee.png'
}"
chip
size="xl"
/>
</template>
Ориентация
Пропс orientation меняет ориентацию. По умолчанию horizontal.
Иван Петров
Инженер-программист
<template>
<B24User
orientation="vertical"
name="Иван Петров"
description="Инженер-программист"
:avatar="{
src: '/b24ui/avatar/employee.png'
}"
/>
</template>
Ссылка
Можно передать любое свойство компонента <NuxtLink>, например to, target, rel и другие.
<template>
<B24User
to="https://github.com/bitrix24"
target="_blank"
name="Имя пользователя"
description="Описание пользователя"
:avatar="{
src: 'https://github.com/bitrix24.png'
}"
/>
</template>
Компонент
NuxtLink наследует все остальные атрибуты, которые вы передали компоненту User.API
Пропсы
Слоты
Тема
https://github.com/bx-shef/b24-ui/tree/main/src/theme/user.ts
export default {
slots: {
root: 'relative group/user',
wrapper: '',
name: 'font-(--ui-font-weight-medium)',
description: 'text-description',
avatar: 'shrink-0'
},
variants: {
orientation: {
horizontal: {
root: 'flex items-center'
},
vertical: {
root: 'flex flex-col'
}
},
to: {
true: {
name: 'text-label peer-hover:text-(--ui-color-design-selection-content) peer-focus-visible:text-(--ui-color-design-selection-content) transition-colors',
description: 'peer-hover:text-(--ui-color-design-selection-content) peer-focus-visible:text-(--ui-color-design-selection-content) transition-colors',
avatar: 'transform transition-transform duration-200 motion-reduce:transition-none group-hover/user:scale-115 group-has-focus-visible/user:scale-115'
},
false: {
name: 'text-label',
description: ''
}
},
size: {
'3xs': {
root: 'gap-1',
wrapper: 'flex items-center gap-1',
name: 'text-(length:--ui-font-size-xs)',
description: 'text-(length:--ui-font-size-xs)'
},
'2xs': {
root: 'gap-1.5',
wrapper: 'flex items-center gap-1.5',
name: 'text-(length:--ui-font-size-xs)',
description: 'text-(length:--ui-font-size-xs)'
},
xs: {
root: 'gap-1.5',
wrapper: 'flex items-center gap-1.5',
name: 'text-(length:--ui-font-size-xs)',
description: 'text-(length:--ui-font-size-xs)'
},
sm: {
root: 'gap-2',
name: 'text-(length:--ui-font-size-xs)',
description: 'text-(length:--ui-font-size-xs)'
},
md: {
root: 'gap-2',
name: 'text-(length:--ui-font-size-sm)',
description: 'text-(length:--ui-font-size-xs)'
},
lg: {
root: 'gap-2.5',
name: 'text-(length:--ui-font-size-sm)',
description: 'text-(length:--ui-font-size-sm)'
},
xl: {
root: 'gap-2.5',
name: 'text-(length:--ui-font-size-md)',
description: 'text-(length:--ui-font-size-sm)'
},
'2xl': {
root: 'gap-3',
name: 'text-(length:--ui-font-size-md)',
description: 'text-(length:--ui-font-size-md)'
},
'3xl': {
root: 'gap-3',
name: 'text-(length:--ui-font-size-lg)',
description: 'text-(length:--ui-font-size-md)'
}
}
},
defaultVariants: {
size: 'md'
}
}