Installation in Nuxt Application
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:
npx nuxi init -t github:bitrix24/starter-b24ui <my-app>
TIP
The <my-app>
argument is the name of the directory where the project will be created, replace it with your project name.
Once the installation is complete, navigate into your project and start the development server:
cd <my-app>
npm run dev
Add to a Nuxt project
1. Install @bitrix24/b24ui and @bitrix24/b24icons-vue packages
pnpm add @bitrix24/b24ui-nuxt
pnpm add @bitrix24/b24icons-vue
yarn add @bitrix24/b24ui-nuxt
yarn add @bitrix24/b24icons-vue
npm install @bitrix24/b24ui-nuxt
npm install @bitrix24/b24icons-vue
bun add @bitrix24/b24ui-nuxt
bun add @bitrix24/b24icons-vue
WARNING
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.
2. Add the Bitrix24 UI module in your nuxt.config.ts
export default defineNuxtConfig({
modules: ['@bitrix24/b24ui-nuxt']
})
3. Import Tailwind CSS and Bitrix24 UI in your CSS
@import "tailwindcss";
@import "@bitrix24/b24ui-nuxt";
TIP
Use the css
property in your nuxt.config.ts
to import your CSS file.
export default defineNuxtConfig({
modules: ['@bitrix24/b24ui-nuxt'],
css: ['~/assets/css/main.css']
})
INFO
It's recommended to install the Tailwind CSS IntelliSense extension for VSCode and add the following settings:
"files.associations": {
"*.css": "tailwindcss"
},
"editor.quickSuggestions": {
"strings": "on"
}
4. Wrap your app with App component
<template>
<B24App>
<NuxtPage />
</B24App>
</template>
TIP
The App
component provides global configurations and is required for Toast and Tooltip components to work.
Options
You can customize Bitrix24 UI by providing options in your nuxt.config.ts
.
colorMode
Use the colorMode
option to enable or disable the @nuxt/color-mode
module.
- Default:
true
export default defineNuxtConfig({
modules: ['@bitrix24/b24ui-nuxt'],
b24ui: {
colorMode: false
}
})