v2.1.8
  • 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.8
  • Docs
  • Components
  • Composables
  • Typography

Content

Bitrix24 UI integrates with Nuxt Content to deliver beautiful typography and consistent component styling.
this docs

Installation

To get started, you can follow the official guide or in summary:

pnpm add @nuxt/content
yarn add @nuxt/content
npm install @nuxt/content
bun add @nuxt/content

Then, add the @nuxt/content module in your nuxt.config.ts:

nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    '@bitrix24/b24ui-nuxt',
    '@nuxt/content'
  ],
  css: ['~/assets/css/main.css']
})
You need to register @nuxt/content after @bitrix24/b24ui-nuxt in the modules array, otherwise the prose components will not be available.

Configuration

When using Tailwind CSS classes in your markdown content files, you need to ensure Tailwind can detect and generate the necessary utility classes. By default, Tailwind's automatic content detection might not pick up classes written in markdown files.

To fix this, use the @source directive in your CSS file to explicitly include your content directory:

app/assets/css/main.css
@import "tailwindcss";
@import "@bitrix24/b24ui-nuxt";

@source "../../../content/**/*";

This ensures that:

  • Tailwind scans all markdown files in your content directory
  • Any utility classes used in your markdown are included in the final CSS
  • Dynamic classes in MDC components or custom Vue components within your content work properly
You can also use glob patterns to be more specific about which files to scan:
  • @source "../../../content/docs/**/*.md" - Only scan markdown in the docs folder
  • @source "../../../content/**/*.{md,yml}" - Include both markdown and YAML files
Learn more about Tailwind's automatic content detection and best practices for optimizing build performance.

Components

You might be using @nuxt/content to build a documentation. To help you with that, we've built some components that you can use in your pages:

  • a built-in full-text search command palette with ContentSearch, replacing the need for Algolia DocSearch
  • a sticky Table of Contents with the ContentToc component
  • a prev / next navigation with the ContentSurround component

Typography

Bitrix24 UI provides its own custom implementations of all prose components for seamless integration with @nuxt/content. This approach ensures consistent styling, complete control over typography, and perfect alignment with the Bitrix24 UI design system so your content always looks and feels cohesive out of the box.

Discover the full Typography system and explore all available prose components for rich, consistent content presentation.

Utils

mapContentNavigation

This util will map the navigation from queryCollectionNavigation and transform it recursively into an array of objects that can be used by various components.

mapContentNavigation(navigation, options?)

  • navigation: The navigation tree (array of ContentNavigationItem).
  • options (optional):
    • labelAttribute: (string) Which field to use as label (title by default)
    • deep: (number or undefined) Controls how many levels of navigation are included (undefined by default : includes all levels)

Example: As shown in the breadcrumb example below, it's commonly used to transform the navigation data into the correct format.

app.vue
<script setup lang="ts">
import { mapContentNavigation } from '@bitrix24/b24ui-nuxt/utils/content'
import { findPageBreadcrumb } from '@nuxt/content/utils'

const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('content'))

const breadcrumb = computed(() => mapContentNavigation(findPageBreadcrumb(navigation?.value, page.value?.path, { indexAsChild: true })).map(({ icon, ...link }) => link), { deep: 0 })
</script>

<template>
  <B24Page>
    <B24PageHeader v-bind="page">
      <template #headline>
        <B24Breadcrumb :items="breadcrumb" />
      </template>
    </B24PageHeader>
  </B24Page>
</template>

I18n

Bitrix24 UI supports 19 locales and multi-directional (LTR/RTL) internationalization.

MCP Server

Use Bitrix24 UI components in your AI assistants with Model Context Protocol support.

On this page

  • Installation
  • Configuration
  • Components
  • Typography
  • Utils
    • mapContentNavigation
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24