v2.1.8
/
  • 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
  • Content
  • ContentSearch
  • ContentSearchButton
  • ContentSurround
  • ContentToc
  • Color Mode
  • ColorModeAvatar
  • ColorModeButton
  • ColorModeImage
  • ColorModeSelect
  • ColorModeSwitch
  • i18n
  • LocaleSelect
  • b24icons
  • b24jssdk
Use our Nuxt starter
v2.1.8
  • 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
{
  "wait": "Loading client-side content..."
}
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.

{
  "wait": "Loading client-side content..."
}

Size

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

{
  "wait": "Loading client-side content..."
}
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.

{
  "wait": "Loading client-side content..."
}

Text

Use the text prop to display a fallback text.

+24
{
  "wait": "Loading client-side content..."
}

Alt

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

EN
{
  "wait": "Loading client-side content..."
}
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
{
  "wait": "Loading client-side content..."
}

Examples

With tooltip

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

Employee Name
{
  "wait": "Loading client-side content..."
}

With mask

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

Employee Name
{
  "wait": "Loading client-side content..."
}

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