---
title: "DashboardNavbar"
description: "Адаптивная навигационная панель для дашбордов."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/dashboard-navbar"
---
# DashboardNavbar

> Адаптивная навигационная панель для дашбордов.

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

Компонент DashboardNavbar — адаптивная навигационная панель, которая работает вместе с [DashboardSidebar](https://b24-ui.bx-shef.by/raw/docs/components/dashboard-sidebar.md). В ней есть кнопка для мобильных устройств, которая открывает навигацию в раскладках дашборда.

Используйте его в слоте `header` компонента [DashboardPanel](https://b24-ui.bx-shef.by/raw/docs/components/dashboard-panel.md):

```vue [pages/index.vue]
<script setup lang="ts">
definePageMeta({
  layout: 'dashboard'
})
</script>

<template>
  <B24DashboardPanel>
    <template #header>
      <B24DashboardNavbar />
    </template>
  </B24DashboardPanel>
</template>
```

Слоты `left`, `default` и `right` настраивают панель.

```vue [DashboardNavbarExample.vue]
<template>
  <B24DashboardNavbar title="Входящие" class="bg-(--ui-color-design-outline-bg-alt) backdrop-blur-md">
    <template #leading>
      <B24DashboardSidebarCollapse />
    </template>

    <template #trailing>
      <B24Badge label="4" />
    </template>

    <template #right>
      <B24FieldGroup>
        <B24Button label="Все" />
        <B24Button label="Непрочитанные" />
      </B24FieldGroup>
    </template>
  </B24DashboardNavbar>
</template>
```

### Заголовок

Пропс `title` задаёт заголовок панели.

```vue
<template>
  <B24DashboardNavbar title="Дашборд" />
</template>
```

> [!TIP]
> По умолчанию заголовок отрисовывается как `h1`. Чтобы изменить тег, передайте в пропс `as` объект: например, `:as="{ title: 'h2' }"`. Так же можно задать корневой элемент: `:as="{ root: 'section', title: 'h2' }"`.

### Иконка

Пропс `icon` задаёт иконку панели.

```vue
<script setup lang="ts">
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
</script>

<template>
  <B24DashboardNavbar title="Дашборд" :icon="RocketIcon" />
</template>
```

### Кнопка переключения

Пропс `toggle` настраивает кнопку переключения, которая показывается на мобильных устройствах и открывает [DashboardSidebar](https://b24-ui.bx-shef.by/raw/docs/components/dashboard-sidebar.md).

Кнопку можно настроить любым свойством компонента [Button](https://b24-ui.bx-shef.by/raw/docs/components/button.md).

```vue [DashboardNavbarToggleExample.vue]
<template>
  <B24DashboardNavbar
    title="Дашборд"
    :toggle="{
      color: 'air-primary',
      rounded: true
    }"
    class="bg-(--ui-color-design-outline-bg-alt) backdrop-blur-md"
  />
</template>
```

### Сторона кнопки

Пропс `toggle-side` меняет сторону, с которой стоит кнопка переключения. По умолчанию `left`.

```vue [DashboardNavbarToggleSideExample.vue]
<template>
  <B24DashboardNavbar
    title="Дашборд"
    toggle-side="right"
    class="bg-(--ui-color-design-outline-bg-alt) backdrop-blur-md"
  />
</template>
```

## API

### Пропсы

```ts
/**
 * Props for the DashboardNavbar component
 */
interface DashboardNavbarProps {
  /**
   * The element or component this component should render as.
   * @default 'div'
   */
  as?: any;
  /**
   * The icon displayed next to the title.
   */
  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;
  title?: string | undefined;
  /**
   * Customize the toggle button to open the sidebar.
   * `{ color: 'air-tertiary', size: 'md' }`
   * @default true
   */
  toggle?: boolean | Omit<ButtonProps, LinkPropsKeys> | undefined;
  /**
   * The side to render the toggle button on.
   * @default 'left'
   */
  toggleSide?: "left" | "right" | undefined;
  b24ui?: { root?: SlotClass; left?: SlotClass; icon?: SlotClass; title?: SlotClass; center?: SlotClass; right?: SlotClass; toggle?: SlotClass; } | undefined;
}
```

### Слоты

```ts
/**
 * Slots for the DashboardNavbar component
 */
interface DashboardNavbarSlots {
  title(): any;
  leading(): any;
  trailing(): any;
  left(): any;
  default(): any;
  right(): any;
  toggle(): any;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    dashboardNavbar: {
      slots: {
        root: 'h-(--b24ui-header-height) shrink-0 flex items-center justify-between ps-2 pe-4 lg:ps-4 lg:pe-4 gap-1.5',
        left: 'flex items-center gap-1.5 min-w-0',
        icon: 'shrink-0 size-5 self-center me-1.5',
        title: 'flex items-center gap-1.5 text-[length:25px] bitrix-mobile:text-[length:18px] font-medium text-(--ui-color-base-1) truncate',
        center: 'hidden lg:flex',
        right: 'flex items-center shrink-0 gap-3',
        toggle: ''
      },
      variants: {
        toggleSide: {
          left: {
            toggle: ''
          },
          right: {
            toggle: ''
          }
        }
      }
    }
  }
})
```

## Sitemap

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