---
title: "ColorModeButton"
description: "Кнопка переключения между светлой и тёмной темой."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/color-mode-button"
---
# ColorModeButton

> Кнопка переключения между светлой и тёмной темой.

## Использование

Компонент ColorModeButton расширяет компонент [Button](https://b24-ui.bx-shef.by/raw/docs/components/button.md), поэтому ему можно передать любое свойство: `color`, `size` и другие.

```vue
<template>
  <B24ColorModeButton />
</template>
```

> [!NOTE]
> По умолчанию у кнопки `color="air-tertiary-no-accent"`.

## API

### Пропсы

```ts
/**
 * Props for the ColorModeButton component
 */
interface ColorModeButtonProps {
  /**
   * @default 'air-tertiary-no-accent'
   */
  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";
  /**
   * The element or component this component should render as when not a link.
   * @default 'button'
   */
  as?: any;
  b24ui?: { base?: SlotClass; baseLoading?: SlotClass; baseLoadingWaitIcon?: SlotClass; baseLoadingClockIcon?: SlotClass; baseLoadingSpinnerIcon?: SlotClass; baseLine?: SlotClass; label?: SlotClass; labelInner?: SlotClass; leadingIcon?: SlotClass; leadingAvatar?: SlotClass; leadingAvatarSize?: SlotClass; trailingIcon?: SlotClass; safeList?: SlotClass; } | undefined;
  onClick?: (event: MouseEvent): void | ((event: MouseEvent) => void)[] | undefined;
  /**
   * When `true`, the loading icon will be displayed.
   */
  loading?: boolean | undefined;
  /**
   * Display an icon on the left side.
   */
  icon?: (props: HTMLAttributes & VNodeProps & {}, ctx: Omit<{ attrs: Attrs; slots: Readonly<InternalSlots>; emit: (event: string, ...args: any[]) => void; expose: <Exposed extends Record<string, any> = Record<...>>(exposed?: Exposed | undefined) => void; }, "expose">): any | undefined;
  /**
   * @default 'md'
   */
  size?: "md" | "xs" | "sm" | "lg" | "xl" | "xss" | undefined;
  /**
   * Display an avatar on the left side.
   */
  avatar?: AvatarProps | undefined;
  /**
   * Class to apply when the link is exact active
   */
  exactActiveClass?: string | undefined;
  /**
   * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
   */
  viewTransition?: boolean | undefined;
  autofocus?: false | true | "true" | "false" | undefined;
  disabled?: boolean | undefined;
  form?: string | undefined;
  formaction?: string | undefined;
  formenctype?: string | undefined;
  formmethod?: string | undefined;
  formnovalidate?: false | true | "true" | "false" | undefined;
  formtarget?: string | undefined;
  name?: string | undefined;
  /**
   * The type of the button when not a link.
   * @default 'button'
   */
  type?: "reset" | "submit" | "button" | undefined;
  label?: string | undefined;
  activeColor?: "link" | "default" | "air-secondary-no-accent" | "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-tertiary" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost" | "danger" | "success" | "warning" | "primary" | "secondary" | "collab" | "ai" | undefined;
  /**
   * @default 'normal'
   * @deprecated Renders nothing on the `air-*` colours, the default among
   *   them: the `depth` compound variants are keyed on the legacy colour
   *   names only.
   * @removed 3.0.0
   */
  depth?: "light" | "dark" | "normal" | undefined;
  /**
   * @deprecated Same as `depth` — no effect on the `air-*` colours.
   * @removed 3.0.0
   */
  activeDepth?: "light" | "dark" | "normal" | undefined;
  /**
   * Rounds the corners of the button
   * @default false
   */
  rounded?: boolean | undefined;
  /**
   * Render the button full width
   * @default false
   */
  block?: boolean | undefined;
  /**
   * Set loading state automatically based on the `@click` promise state
   * @default false
   */
  loadingAuto?: boolean | undefined;
  /**
   * Disable uppercase label
   * @default true
   */
  normalCase?: boolean | undefined;
  /**
   * Shows LoaderWaitIcon in loading mode
   * @default false
   */
  useWait?: boolean | undefined;
  /**
   * Shows LoaderClockIcon icon in loading mode
   * @default false
   */
  useClock?: boolean | undefined;
  /**
   * Shows a dropdown chevron on the right side, from the dictionary's
   * `chevronDown` role, so an `app.config` override reaches it.
   * @default false
   */
  useDropdown?: boolean | undefined;
}
```

> [!NOTE]
> See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
> Компонент поддерживает и все нативные HTML-атрибуты `<button>`.

### Слоты

```ts
/**
 * Slots for the ColorModeButton component
 */
interface ColorModeButtonSlots {
}
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
