v2.15.0

DashboardSidebarCollapse

Кнопка для десктопа, которая сворачивает боковое меню и освобождает место для контента.

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

Компонент DashboardSidebarCollapse сворачивает и разворачивает DashboardSidebar при заданном пропсе collapsible.

<template>
  <B24DashboardSidebarCollapse />
</template>

Компонент расширяет Button, поэтому ему можно передать любое свойство: color, size и другие.

<template>
  <B24DashboardSidebarCollapse color="air-primary" />
</template>
По умолчанию у кнопки color="air-tertiary".

Примеры

В слоте header

Компонент можно поставить в слот header компонента DashboardSidebar и, например, скрыть левую часть шапки пропсом collapsed:

layouts/dashboard.vue
<template>
  <B24DashboardGroup>
    <B24DashboardSidebar collapsible>
      <template #header="{ collapsed }">
        <Logo v-if="!collapsed" />

        <B24DashboardSidebarCollapse />
      </template>
    </B24DashboardSidebar>

    <slot />
  </B24DashboardGroup>
</template>

В слоте leading

Компонент можно поставить в слот leading компонента DashboardNavbar, например чтобы показать его перед заголовком:

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

<template>
  <B24DashboardPanel>
    <template #header>
      <B24DashboardNavbar title="Home">
        <template #leading>
          <B24DashboardSidebarCollapse />
        </template>
      </B24DashboardNavbar>
    </template>
  </B24DashboardPanel>
</template>

API

Пропсы

Prop Default Type
as'button'any

The element or component this component should render as when not a link.

color'air-tertiary'"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" | "link"
side'left' "left" | "right"

The side of the sidebar to collapse.

iconIconComponent

Display an icon on the left side.

avatar AvatarProps

Display an avatar on the left side.

loadingboolean

When true, the loading icon will be displayed.

autofocus false | true | "true" | "false"
disabledboolean
name string
type'button' "reset" | "submit" | "button"

The type of the button when not a link.

label string
activeColor"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" | "link"
depth'normal' "light" | "normal" | "dark"
Deprecated — removed in 3.0.0

Renders nothing on the air-* colours, the default among them: the depth compound variants are keyed on the legacy colour names only.

activeDepth "light" | "normal" | "dark"
Deprecated — removed in 3.0.0

Same as depth — no effect on the air-* colours.

size'md' "xs" | "md" | "xss" | "sm" | "lg" | "xl"
roundedfalseboolean

Rounds the corners of the button

blockfalseboolean

Render the button full width

loadingAutofalseboolean

Set loading state automatically based on the @click promise state

normalCasetrueboolean

Disable uppercase label

useWaitfalseboolean

Shows LoaderWaitIcon in loading mode

useClockfalseboolean

Shows LoaderClockIcon icon in loading mode

useDropdownfalseboolean

Shows a dropdown chevron on the right side, from the dictionary's chevronDown role, so an app.config override reaches it.

b24ui { base?: any; }
Компонент поддерживает и все нативные HTML-атрибуты <button>.

Тема

https://github.com/bx-shef/b24-ui/tree/main/src/theme/dashboard-sidebar-collapse.ts
export default {
  base: 'hidden lg:flex',
  variants: {
    side: {
      left: '',
      right: ''
    }
  }
}