New components have been implemented! Explore them.
v2.1.1
  • Get Started
  • Components
  • Composables
  • Typography
  • GitHub
  • Overview
  • Introduction
  • Installation
  • Installation
  • Migration
  • Contribution
  • Theme
  • Design System
  • CSS Variables
  • Components
  • Integrations
  • Icons
  • Icons
  • Color Mode
  • Color Mode
  • I18n
  • I18n
  • Content
  • AI Tools
  • MCP Server
  • LLMs.txt
  • b24icons
  • b24jssdk
Use our Nuxt starter
v2.1.1
  • Docs
  • Components
  • Composables
  • Typography

Installation

Learn how to install and configure Bitrix24 UI in your Nuxt application.
Looking for the Vue version?

Setup

Use our Nuxt Starter

Start your project using the bitrix24/starter-b24ui template with Bitrix24 UI pre-configured.

Create a new project locally by running the following command:

git clone https://github.com/bitrix24/starter-b24ui.git <project-name>
cd <project-name>
pnpm install
pnpm run dev
The <project-name> argument is the name of the directory where the project will be created, replace it with your project name.

Add to a Nuxt project

Install the Bitrix24 UI package

pnpm add @bitrix24/b24ui-nuxt
yarn add @bitrix24/b24ui-nuxt
npm install @bitrix24/b24ui-nuxt
bun add @bitrix24/b24ui-nuxt
If you're using pnpm, ensure that you either set shamefully-hoist=true in your .npmrc file or install tailwindcss in your project's root directory.

Add the Bitrix24 UI module in your nuxt.config.ts

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@bitrix24/b24ui-nuxt']
})

Import Tailwind CSS and Bitrix24 UI in your CSS

@import "tailwindcss";
@import "@bitrix24/b24ui-nuxt";
export default defineNuxtConfig({
  modules: ['@bitrix24/b24ui-nuxt'],
  css: ['~/assets/css/main.css']
})
It's recommended to install the Tailwind CSS IntelliSense extension for VSCode and add the following settings:
.vscode/settings.json
{
  "files.associations": {
    "*.css": "tailwindcss"
  },
  "editor.quickSuggestions": {
    "strings": "on"
  },
  "tailwindCSS.classAttributes": ["class", "b24ui"],
  "tailwindCSS.experimental.classRegex": [
    ["b24ui:\\s*{([^)]*)\\s*}", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
  ]
}

Wrap your app with App component

app.vue
<template>
  <B24App>
    <NuxtPage />
  </B24App>
</template>
The App component provides global configurations and is required for Toast, Tooltip components to work as well as Programmatic Overlays.

Options

You can customize Bitrix24 UI by providing options in your nuxt.config.ts.

colorMode

Use the colorMode option to enable or disable the color mode integration from @vueuse/core.

  • Default: true
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@bitrix24/b24ui-nuxt'],
  css: ['~/assets/css/main.css'],
  b24ui: {
    colorMode: false
  }
})

theme.prefix

Use the theme.prefix option to configure the same prefix you set on your Tailwind CSS import. This ensures Bitrix24 UI components use the correct prefixed utility classes and CSS variables.

export default defineNuxtConfig({
  modules: ['@bitrix24/b24ui-nuxt'],
  css: ['~/assets/css/main.css'],
  b24ui: {
    theme: {
      prefix: 'tw'
    }
  }
})
@import "tailwindcss" prefix(tw);
@import "@bitrix24/b24ui-nuxt";

This will automatically prefix all Tailwind utility classes and CSS variables in Bitrix24 UI component themes:

<!-- Without prefix -->
<button class="px-2 py-1 text-xs hover:bg-red-500/75">Button</button>

<!-- With prefix: tw -->
<button class="tw:px-2 tw:py-1 tw:text-xs tw:hover:bg-red-500/75">Button</button>
Learn more about using a prefix in the Tailwind CSS documentation.

mdc

Use the mdc option to force the import of Bitrix24 UI <Prose> components even if @nuxtjs/mdc or @nuxt/content is not installed.

  • Default: true
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@bitrix24/b24ui-nuxt'],
  css: ['~/assets/css/main.css'],
  b24ui: {
    mdc: false
  }
})

content

Use the content option to force the import of Bitrix24 UI <Prose> and <B24Content> components even if @nuxt/content is not installed (@nuxtjs/mdc is installed by @nuxt/content).

  • Default: false
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@bitrix24/b24ui-nuxt'],
  css: ['~/assets/css/main.css'],
  b24ui: {
    content: true
  }
})

experimental.componentDetection

Use the experimental.componentDetection option to enable automatic component detection for tree-shaking. This feature scans your source code to detect which components are actually used and only generates the necessary CSS for those components (including their dependencies).

  • Default: false
  • Type: boolean | string[]

Enable automatic detection:

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@bitrix24/b24ui-nuxt'],
  css: ['~/assets/css/main.css'],
  b24ui: {
    experimental: {
      componentDetection: true
    }
  }
})

Include additional components for dynamic usage:

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@bitrix24/b24ui-nuxt'],
  css: ['~/assets/css/main.css'],
  b24ui: {
    experimental: {
      componentDetection: ['Modal', 'Dropdown', 'Popover']
    }
  }
})
When providing an array of component names, automatic detection is enabled and these components (along with their dependencies) are guaranteed to be included. This is useful for dynamic components like <component :is="..." /> that can't be statically analyzed.

Introduction

Bitrix24 UI is a comprehensive UI library for Vue and Nuxt applications, offering a collection of fully styled and accessible components.

Migration

A comprehensive guide to migrate your application from Bitrix24 UI v1 to Bitrix24 UI v2.

On this page

  • Setup
    • Use our Nuxt Starter
    • Add to a Nuxt project
  • Options
    • colorMode
    • theme.prefix
    • mdc
    • content
    • experimental.componentDetection
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24