The Editor component is now implemented! Check it out.
v2.1.16
/
  • Get Started
  • Components
  • Composables
  • Typography
  • GitHub
  • Layout
  • App
  • Container
  • Error
  • SidebarLayout
  • Element
  • Advice
  • Alert
  • Avatar
  • AvatarGroup
  • Badge
  • Banner
  • Button
  • Calendar
  • Card
  • Chip
  • Collapsible
  • Countdown
  • FieldGroup
  • Kbd
  • Progress
  • Separator
  • Skeleton
  • Form
  • Checkbox
  • CheckboxGroup
  • ColorPicker
  • FileUpload
  • Form
  • FormField
  • Input
  • InputDate
  • InputMenu
  • InputNumber
  • InputTags
  • InputTime
  • PinInput
  • RadioGroup
  • Range
  • Select
  • SelectMenu
  • Switch
  • Textarea
  • Data
  • Accordion
  • DescriptionList
  • Empty
  • Table
  • TableWrapper
  • Timeline
  • User
  • Navigation
  • Breadcrumb
  • CommandPalette
  • Link
  • NavigationMenu
  • Pagination
  • Stepper
  • Tabs
  • Overlay
  • ContextMenu
  • DropdownMenu
  • Modal
  • Popover
  • Slideover
  • Toast
  • Tooltip
  • Page
  • PageCard
  • PageColumns
  • PageGrid
  • PageLinks
  • PageList
  • Dashboard
  • DashboardGroup
  • DashboardSearch
  • DashboardSearchButton
  • AI Chat
  • soonChatMessage
  • soonChatMessages
  • soonChatPalette
  • soonChatPrompt
  • soonChatPromptSubmit
  • Editor
  • NewEditor
  • NewEditorDragHandle
  • NewEditorEmojiMenu
  • NewEditorMentionMenu
  • NewEditorSuggestionMenu
  • NewEditorToolbar
  • Content
  • ContentSearch
  • ContentSearchButton
  • ContentSurround
  • ContentToc
  • Color Mode
  • ColorModeAvatar
  • ColorModeButton
  • ColorModeImage
  • ColorModeSelect
  • ColorModeSwitch
  • i18n
  • LocaleSelect
  • b24icons
  • b24jssdk
Use our Nuxt starter
v2.1.16
  • Docs
  • Components
  • Composables
  • Typography

Avatar

An img element that includes fallback and supports Nuxt Image.
GitHub
Demo
Nuxt UI

Usage

The Avatar uses the <NuxtImg> component when @nuxt/image is installed, falling back to img otherwise.

employee
<template>
  <B24Avatar src="/b24ui/avatar/employee.png" alt="employee" />
</template>
You can pass any property from the HTML <img> element such as alt, loading, etc.

Src

Use the src prop to set the image URL.

<template>
  <B24Avatar src="https://github.com/bitrix24.png" />
</template>

Size

Use the size prop to set the size of the Avatar.

<template>
  <B24Avatar size="2xl" src="/b24ui/avatar/assistant.png" />
</template>
The <img> element's width and height are automatically set based on the size prop.

Icon

Use the icon prop to display a fallback Icon.

<script setup lang="ts">
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
</script>

<template>
  <B24Avatar :icon="RocketIcon" size="md" />
</template>

Text

Use the text prop to display a fallback text.

+24
<template>
  <B24Avatar text="+24" size="xl" />
</template>

Alt

When no icon or text is provided, the initials of the alt prop is used as fallback.

EN
<template>
  <B24Avatar alt="Employee Name" size="xl" />
</template>
The alt prop is passed to the img element as the alt attribute.

Chip

Use the chip prop to display a chip around the Avatar.

+1
<template>
  <B24Avatar
    src="/b24ui/avatar/assistant.png"
    :chip="{
      text: '+1',
      inset: true,
      hideZero: true
    }"
  />
</template>

Examples

With tooltip

You can use a Tooltip component to display a tooltip when hovering the Avatar.

Employee Name
<template>
  <B24Tooltip text="Employee Name">
    <B24Avatar
      src="/b24ui/avatar/employee.png"
      alt="Employee Name"
    />
  </B24Tooltip>
</template>

With mask

You can use a CSS mask to display an Avatar with a custom shape instead of a simple circle.

Employee Name
<template>
  <B24Avatar class="rounded-none squircle" src="/b24ui/avatar/employee.png" alt="Employee Name" size="3xl" />
</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>

API

Props

Prop Default Type
as'span'any

The element or component this component should render as.

src string
alt string
iconIconComponent

Display an icon on the left side.

text string
size'md' "md" | "3xs" | "2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "3xl"
chipboolean | ChipProps
  • as?: any

    The element or component this component should render as. Defaults to 'div'.

  • text?: string | number

    Display some text inside the chip.

  • trailingIcon?: IconComponent

    The icon displayed on the right side of the chip.

  • color?: "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-warning" | "air-primary-copilot" | "air-secondary" | "air-secondary-accent" | "air-secondary-accent-1" | "air-tertiary"

    Defaults to 'danger'.

  • inverted?: boolean

    If set to true the color is inverted. Used for 'air-primary', 'air-primary-success', 'air-primary-alert', 'air-primary-copilot' and 'air-primary-warning' colors. Defaults to false.

  • size?: "md" | "sm" | "lg"

    Defaults to 'sm'.

  • position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"

    The position of the chip. Defaults to 'top-right'.

  • inset?: boolean

    When true, keep the chip inside the component for rounded elements Defaults to false.

  • standalone?: boolean

    When true, render the chip relatively to the parent. Defaults to false.

  • hideZero?: boolean

    When true, hide chip if value='0' Defaults to false.

  • class?: any
  • b24ui?: { root?: ClassNameValue; base?: ClassNameValue; trailingIcon?: ClassNameValue; }
crossorigin "" | "anonymous" | "use-credentials"
decoding "async" | "auto" | "sync"
height string | number
loading "lazy" | "eager"
referrerpolicy "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"
sizes string
srcset string
usemap string
width string | number
b24ui { root?: ClassNameValue; image?: ClassNameValue; fallback?: ClassNameValue; icon?: ClassNameValue; }
This component also supports all native <img> HTML attributes.

Theme

app.config.ts
export default defineAppConfig({
  b24ui: {
    avatar: {
      slots: {
        root: 'air-secondary-accent inline-flex items-center justify-center shrink-0 select-none rounded-full align-middle bg-(--ui-color-base-8) ring ring-(--ui-color-base-7)',
        image: 'h-full w-full rounded-[inherit] object-cover',
        fallback: 'font-(--ui-font-weight-medium) text-(--ui-color-design-plain-content-icon-secondary) truncate',
        icon: 'text-(--ui-color-design-plain-content-icon-secondary) shrink-0'
      },
      variants: {
        size: {
          '3xs': {
            root: 'size-[10px] text-4xs font-(--ui-font-weight-regular)',
            icon: 'size-[10px]'
          },
          '2xs': {
            root: 'size-[20px] text-(length:--ui-font-size-4xs)/(--ui-font-line-height-reset) font-(--ui-font-weight-regular)',
            icon: 'size-[18px]'
          },
          xs: {
            root: 'size-[24px] text-(length:--ui-font-size-3xs)/(--ui-font-line-height-reset) font-(--ui-font-weight-regular)',
            icon: 'size-[22px]'
          },
          sm: {
            root: 'size-[28px] text-(length:--ui-font-size-xs)/(--ui-font-line-height-reset)',
            icon: 'size-[26px]'
          },
          md: {
            root: 'size-[32px] text-(length:--ui-font-size-sm)/(--ui-font-line-height-reset)',
            icon: 'size-[28px]'
          },
          lg: {
            root: 'size-[42px] text-(length:--ui-font-size-2xl)/(--ui-font-line-height-reset)',
            icon: 'size-[38px]'
          },
          xl: {
            root: 'ring-2 size-[48px] text-(length:--ui-font-size-2xl)/(--ui-font-line-height-reset)',
            icon: 'size-[44px]'
          },
          '2xl': {
            root: 'ring-2 size-[60px] text-(length:--ui-font-size-5xl)/(--ui-font-line-height-reset)',
            icon: 'size-[56px]'
          },
          '3xl': {
            root: 'ring-2 size-[94px] text-[34px]/(--ui-font-line-height-reset)',
            icon: 'size-[90px]'
          }
        }
      },
      defaultVariants: {
        size: 'md'
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'

export default defineConfig({
  plugins: [
    vue(),
    bitrix24UIPluginVite({
      b24ui: {
        avatar: {
          slots: {
            root: 'air-secondary-accent inline-flex items-center justify-center shrink-0 select-none rounded-full align-middle bg-(--ui-color-base-8) ring ring-(--ui-color-base-7)',
            image: 'h-full w-full rounded-[inherit] object-cover',
            fallback: 'font-(--ui-font-weight-medium) text-(--ui-color-design-plain-content-icon-secondary) truncate',
            icon: 'text-(--ui-color-design-plain-content-icon-secondary) shrink-0'
          },
          variants: {
            size: {
              '3xs': {
                root: 'size-[10px] text-4xs font-(--ui-font-weight-regular)',
                icon: 'size-[10px]'
              },
              '2xs': {
                root: 'size-[20px] text-(length:--ui-font-size-4xs)/(--ui-font-line-height-reset) font-(--ui-font-weight-regular)',
                icon: 'size-[18px]'
              },
              xs: {
                root: 'size-[24px] text-(length:--ui-font-size-3xs)/(--ui-font-line-height-reset) font-(--ui-font-weight-regular)',
                icon: 'size-[22px]'
              },
              sm: {
                root: 'size-[28px] text-(length:--ui-font-size-xs)/(--ui-font-line-height-reset)',
                icon: 'size-[26px]'
              },
              md: {
                root: 'size-[32px] text-(length:--ui-font-size-sm)/(--ui-font-line-height-reset)',
                icon: 'size-[28px]'
              },
              lg: {
                root: 'size-[42px] text-(length:--ui-font-size-2xl)/(--ui-font-line-height-reset)',
                icon: 'size-[38px]'
              },
              xl: {
                root: 'ring-2 size-[48px] text-(length:--ui-font-size-2xl)/(--ui-font-line-height-reset)',
                icon: 'size-[44px]'
              },
              '2xl': {
                root: 'ring-2 size-[60px] text-(length:--ui-font-size-5xl)/(--ui-font-line-height-reset)',
                icon: 'size-[56px]'
              },
              '3xl': {
                root: 'ring-2 size-[94px] text-[34px]/(--ui-font-line-height-reset)',
                icon: 'size-[90px]'
              }
            }
          },
          defaultVariants: {
            size: 'md'
          }
        }
      }
    })
  ]
})

Alert

An alert designed to capture the user's attention.

AvatarGroup

Pile multiple avatars into a single group.

On this page

  • Usage
    • Src
    • Size
    • Icon
    • Text
    • Alt
    • Chip
  • Examples
    • With tooltip
    • With mask
  • API
    • Props
  • Theme
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24