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

Color Mode

Bitrix24 UI integrates with VueUse to allow for easy switching between light and dark themes.
useColorMode
Looking for the Vue version?
We are still updating this page. Some data may be missing here — we will complete it shortly.

Usage

Bitrix24 UI automatically registers the useDark composable as a Vue plugin, so there's no additional setup required.

Components

You can use the built-in ColorModeAvatar or ColorModeImage components to display different images for light and dark mode and the ColorModeButton, ColorModeSwitch or ColorModeSelect components to switch between light and dark modes.

You can also use the useColorMode composable to build your own custom component:

ColorModeButton.vue
<script setup lang="ts">
import { useColorMode } from '#imports'
import SunIconAir from '@bitrix24/b24icons-vue/outline/SunIcon'
import MoonIconAir from '@bitrix24/b24icons-vue/outline/MoonIcon'

const colorMode = useColorMode()

const isDark = computed({
  get() {
    return colorMode.value === 'dark'
  },
  set(_isDark: boolean) {
    colorMode.preference = _isDark ? 'dark' : 'light'
  }
})
</script>

<template>
  <B24Button
    :icon="isDark ? MoonIconAir : SunIconAir"
    :aria-label="`Switch to ${isDark ? 'light' : 'dark'} mode`"
    @click="isDark = !isDark"
  />
</template>

Configuration

You can disable this plugin with the b24ui.colorMode option in your nuxt.config.ts:

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

Icons

Bitrix24 UI integrates with @bitrix24/b24icons to access over 1,400+ icons.

I18n

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

On this page

  • Usage
    • Components
    • Configuration
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24