v2.15.0

User

Компонент для показа данных пользователя: имени, описания и фото профиля.

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

Имя

Пропс 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

Пропсы

Prop Default Type
as'div'any

The element or component this component should render as.

name string
description string
avatar Omit<AvatarProps, "size"> & { [key: string]: any; }
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"

Default color for the inner B24Avatar. A non-undefined avatar.color overrides it.

chipboolean | Omit<ChipProps, "size" | "inset">
size'md' "md" | "3xs" | "2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "3xl"
orientation'horizontal' "horizontal" | "vertical"

The orientation of the user.

to string | J | W
target null | "_blank" | "_parent" | "_self" | "_top" | string & {}
b24ui { root?: SlotClass; wrapper?: SlotClass; name?: SlotClass; description?: SlotClass; avatar?: SlotClass; }

Слоты

Slot Type
avatar{ b24ui: object; }
name{}
description{}
default{}

Тема

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'
  }
}