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

Banner

Top banner for important user messages.
GitHub
Nuxt UI

Usage

Title

Use the title prop to display a title on the Banner.

The subscription trial has ended. Subscribe to continue using all apps.
{
  "wait": "Loading client-side content..."
}

Icon

Use the icon prop to display an icon on the Banner.

The subscription trial has ended. Subscribe to continue using all apps.
{
  "wait": "Loading client-side content..."
}

Color

Use the color prop to change the color of the Banner.

The subscription trial has ended. Subscribe to continue using all apps.
{
  "wait": "Loading client-side content..."
}

Close

Use the close prop to display a Button to dismiss the Banner. Defaults to false.

A close event will be emitted when the close button is clicked.
<template>
  <B24Banner id="example" title="The subscription trial has ended. Subscribe to continue using all apps." close />
</template>
When closed, banner-${id} will be stored in the local storage to prevent it from being displayed again.
For the example above, banner-example will be stored in the local storage.

Close Icon

Use the close-icon prop to customize the close button Icon. Defaults to CrossMIcon.

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

<template>
  <B24Banner
    title="The subscription trial has ended. Subscribe to continue using all apps."
    close
    :close-icon="CircleCrossIcon"
  />
</template>

Actions

Use the actions prop to add some Button actions to the Banner.

The subscription trial has ended. Subscribe to continue using all apps.
{
  "wait": "Loading client-side content..."
}
The action buttons default to color="air-secondary-no-accen" and size="xs". You can customize these values by passing them directly to each action button.

Link

You can pass any property from the <NuxtLink> component such as to, target, rel, etc.

Explore the Bitrix24 REST API
{
  "wait": "Loading client-side content..."
}
The NuxtLink component will inherit all other attributes you pass to the Banner component.

Examples

Within app.vue

Use the Banner component in your app.vue or in a layout:

app.vue
<template>
  <B24App>
    <B24Banner
      :icon="Bitrix24Icon"
      title="Explore the Bitrix24 REST API"
      to="https://apidocs.bitrix24.com/"
    />
    <NuxtLayout>
      <NuxtPage />
    </NuxtLayout>
  </B24App>
</template>

API

Props

Prop Default Type
as'div'any

The element or component this component should render as.

id'1' string

A unique id saved to local storage to remember if the banner has been dismissed. Change this value to show the banner again.

iconIconComponent

The icon displayed next to the title.

title string
actions ButtonProps[]

Display a list of actions next to the title. { color: 'air-secondary-no-accent', size: 'xs' }

  • label?: string
  • color?: "air-primary" | "air-primary-success" | "air-primary-alert" | "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" | "link"

    Defaults to 'air-secondary-no-accent'.

  • "air-primary" | "air-primary-success" | "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" | "activeColor?: air-primary-alert" | "link"
  • depth?: "light" | "normal" | "dark"

    Defaults to 'normal'.

  • activeDepth?: "light" | "normal" | "dark"
  • size?: "xs" | "md" | "xss" | "sm" | "lg" | "xl"

    Defaults to 'md'.

  • rounded?: boolean

    Rounds the corners of the button Defaults to false.

  • block?: boolean

    Render the button full width Defaults to false.

  • loadingAuto?: boolean

    Set loading state automatically based on the @click promise state Defaults to false.

  • normalCase?: boolean

    Disable uppercase label Defaults to true.

  • useWait?: boolean

    Shows LoaderWaitIcon in loading mode Defaults to false.

  • useClock?: boolean

    Shows LoaderClockIcon icon in loading mode Defaults to false.

  • useDropdown?: boolean

    Shows icons.ChevronDownSIcon on the right side Defaults to false.

  • class?: any
  • b24ui?: { base?: ClassNameValue; baseLoading?: ClassNameValue; baseLoadingWaitIcon?: ClassNameValue; baseLoadingClockIcon?: ClassNameValue; baseLoadingSpinnerIcon?: ClassNameValue; baseLine?: ClassNameValue; label?: ClassNameValue; labelInner?: ClassNameValue; leadingIcon?: ClassNameValue; leadingAvatar?: ClassNameValue; leadingAvatarSize?: ClassNameValue; trailingIcon?: ClassNameValue; safeList?: ClassNameValue; }
  • icon?: IconComponent

    Display an icon on the left side.

  • avatar?: AvatarProps

    Display an avatar on the left side.

  • loading?: boolean

    When true, the loading icon will be displayed.

  • as?: any

    The element or component this component should render as when not a link. Defaults to 'button'.

  • to?: string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric

    Route Location the link should navigate to when clicked on.

  • target?: "_blank" | "_parent" | "_self" | "_top" | (string & {}) | null

    Where to display the linked URL, as the name for a browsing context.

  • autofocus?: Booleanish
  • disabled?: boolean
  • name?: string
  • type?: "reset" | "submit" | "button"

    The type of the button when not a link. Defaults to 'button'.

  • download?: any
  • hreflang?: string
  • media?: string
  • ping?: string
  • referrerpolicy?: HTMLAttributeReferrerPolicy
  • active?: boolean

    Force the link to be active independent of the current route.

  • isAction?: boolean

    When true, uses special underlined styling.

  • trailingSlash?: "append" | "remove"

    An option to either add or remove trailing slashes in the href for this specific link. Overrides the global trailingSlash option if provided.

to string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric
  • name?: RouteRecordNameGeneric
  • params?: RouteParamsRawGeneric
  • path?: undefined

    A relative path to the current location. This property should be removed

  • query?: LocationQueryRaw
  • hash?: string
  • force?: boolean

    Triggers the navigation even if the location is the same as the current one. Note this will also add a new entry to the history unless replace: true is passed.

  • state?: HistoryState

    State to save using the History API. This cannot contain any reactive values and some primitives like Symbols are forbidden. More info at https://developer.mozilla.org/en-US/docs/Web/API/History/state

target null | "_blank" | "_parent" | "_self" | "_top" | string & {}
color'air-primary-alert'"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-tertiary"
closefalseboolean | Partial<ButtonProps>

Display a close button to dismiss the banner. { size: 'md', color: 'air-tertiary-no-accent' }

closeIconicons.closeIconComponent

The icon displayed in the close button.

b24ui { root?: ClassNameValue; container?: ClassNameValue; left?: ClassNameValue; center?: ClassNameValue; right?: ClassNameValue; icon?: ClassNameValue; title?: ClassNameValue; actions?: ClassNameValue; close?: ClassNameValue; }

Slots

Slot Type
leading{ b24ui: object; }
title{}
actions{}
close{ b24ui: object; }

Emits

Event Type
close[]

Theme

app.config.ts
export default defineAppConfig({
  b24ui: {
    banner: {
      slots: {
        root: 'relative z-50 w-full bg-(--b24ui-background) transition-colors',
        container: 'flex items-center justify-between gap-3 h-12',
        left: 'hidden lg:flex-1 lg:flex lg:items-center',
        center: 'flex items-center gap-1.5 min-w-0',
        right: 'lg:flex-1 flex items-center justify-end',
        icon: 'size-5 shrink-0 text-(--b24ui-color) pointer-events-none',
        title: 'text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm) text-(--b24ui-color) font-(--ui-font-weight-medium) truncate',
        actions: 'flex gap-1.5 shrink-0 isolate',
        close: '[--ui-btn-color:var(--b24ui-color)] hover:bg-(--ui-color-base-white-fixed)/10 focus-visible:bg-(--ui-color-base-white-fixed)/10 -me-1.5 lg:me-0'
      },
      variants: {
        color: {
          'air-primary': {
            root: 'style-filled'
          },
          'air-primary-success': {
            root: 'style-filled-success'
          },
          'air-primary-alert': {
            root: 'style-filled-alert'
          },
          'air-primary-copilot': {
            root: 'style-filled-copilot'
          },
          'air-primary-warning': {
            root: 'style-filled-warning'
          },
          'air-secondary': {
            root: 'style-tinted'
          },
          'air-secondary-alert': {
            root: 'style-tinted-alert'
          },
          'air-secondary-accent': {
            root: 'style-outline'
          },
          'air-secondary-accent-1': {
            root: 'style-outline-accent-1'
          },
          'air-secondary-accent-2': {
            root: 'style-outline-accent-2'
          },
          'air-tertiary': {
            root: 'style-outline-no-accent'
          }
        },
        to: {
          true: ''
        }
      },
      compoundVariants: [
        {
          to: true,
          class: {
            root: 'hover:bg-(--b24ui-background)/90'
          }
        }
      ],
      defaultVariants: {
        color: 'air-primary-alert'
      }
    }
  }
})
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: {
        banner: {
          slots: {
            root: 'relative z-50 w-full bg-(--b24ui-background) transition-colors',
            container: 'flex items-center justify-between gap-3 h-12',
            left: 'hidden lg:flex-1 lg:flex lg:items-center',
            center: 'flex items-center gap-1.5 min-w-0',
            right: 'lg:flex-1 flex items-center justify-end',
            icon: 'size-5 shrink-0 text-(--b24ui-color) pointer-events-none',
            title: 'text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm) text-(--b24ui-color) font-(--ui-font-weight-medium) truncate',
            actions: 'flex gap-1.5 shrink-0 isolate',
            close: '[--ui-btn-color:var(--b24ui-color)] hover:bg-(--ui-color-base-white-fixed)/10 focus-visible:bg-(--ui-color-base-white-fixed)/10 -me-1.5 lg:me-0'
          },
          variants: {
            color: {
              'air-primary': {
                root: 'style-filled'
              },
              'air-primary-success': {
                root: 'style-filled-success'
              },
              'air-primary-alert': {
                root: 'style-filled-alert'
              },
              'air-primary-copilot': {
                root: 'style-filled-copilot'
              },
              'air-primary-warning': {
                root: 'style-filled-warning'
              },
              'air-secondary': {
                root: 'style-tinted'
              },
              'air-secondary-alert': {
                root: 'style-tinted-alert'
              },
              'air-secondary-accent': {
                root: 'style-outline'
              },
              'air-secondary-accent-1': {
                root: 'style-outline-accent-1'
              },
              'air-secondary-accent-2': {
                root: 'style-outline-accent-2'
              },
              'air-tertiary': {
                root: 'style-outline-no-accent'
              }
            },
            to: {
              true: ''
            }
          },
          compoundVariants: [
            {
              to: true,
              class: {
                root: 'hover:bg-(--b24ui-background)/90'
              }
            }
          ],
          defaultVariants: {
            color: 'air-primary-alert'
          }
        }
      }
    })
  ]
})

Badge

A short descriptor for a status or category.

Button

A button capable of linking or performing an action.

On this page

  • Usage
    • Title
    • Icon
    • Color
    • Close
    • Close Icon
    • Actions
    • Link
  • Examples
    • Within app.vue
  • API
    • Props
    • Slots
    • Emits
  • Theme
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24