---
title: "DashboardSearchButton"
description: "Готовая кнопка, которая открывает модальное окно DashboardSearch."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/dashboard-search-button"
---
# DashboardSearchButton

> Готовая кнопка, которая открывает модальное окно DashboardSearch.

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

Компонент DashboardSearchButton открывает модальное окно [DashboardSearch](https://b24-ui.bx-shef.by/raw/docs/components/dashboard-search.md).

```vue
<template>
  <B24DashboardSearchButton />
</template>
```

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

```vue
<template>
  <B24DashboardSearchButton color="air-primary-success" />
</template>
```

> [!NOTE]
> See: #collapsed
> По умолчанию кнопка имеет `color="air-secondary-no-accent"`, если не свёрнута, и `color="air-tertiary-no-accent"`, если свёрнута.

### Свёрнутая кнопка

Пропс `collapsed` скрывает подпись кнопки и [клавиши](#kbds). По умолчанию `false`.

```vue
<template>
  <B24DashboardSearchButton />
</template>
```

> [!TIP]
> See: /docs/components/dashboard-sidebar/#slots
> В компоненте **DashboardSidebar** используйте слот-проп `collapsed` напрямую.

### Клавиши

Пропс `kbds` показывает на кнопке клавиши. По умолчанию `['meta', 'K']`, как сочетание клавиш компонента [DashboardSearch](https://b24-ui.bx-shef.by/raw/docs/components/dashboard-search.md#shortcut).

```vue
<template>
  <B24DashboardSearchButton :kbds="{'0':'alt','1':'O'}" />
</template>
```

## API

### Пропсы

```ts
/**
 * Props for the DashboardSearchButton component
 */
interface DashboardSearchButtonProps {
  /**
   * The icon displayed in the button. Set to `false` to hide the icon.
   * @default icons.search
   */
  icon?: false | (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;
  /**
   * The label displayed in the button.
   * @default t('dashboardSearchButton.label')
   */
  label?: string | undefined;
  /**
   * The color of the button.
   * @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";
  /**
   * Whether the button is collapsed.
   * @default false
   */
  collapsed?: boolean | undefined;
  /**
   * Display a tooltip on the button when is collapsed with the button label.
   * This has priority over the global `tooltip` prop.
   * @default false
   */
  tooltip?: boolean | TooltipProps | undefined;
  /**
   * The keyboard keys to display in the button.
   * `{ accent: 'default' }`
   * @default ["meta", "k"]
   */
  kbds?: (string | undefined)[] | KbdProps[] | undefined;
  b24ui?: { base?: SlotClass; baseLine?: SlotClass; label?: SlotClass; trailing?: SlotClass; } & { 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;
  /**
   * The element or component this component should render as when not a link.
   * @default 'button'
   */
  as?: any;
  /**
   * The type of the button when not a link.
   * @default 'button'
   */
  type?: "reset" | "submit" | "button" | undefined;
  /**
   * Display an avatar on the left side.
   */
  avatar?: AvatarProps | undefined;
  /**
   * When `true`, the loading icon will be displayed.
   */
  loading?: boolean | 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 | "false" | "true" | undefined;
  disabled?: boolean | undefined;
  form?: string | undefined;
  formaction?: string | undefined;
  formenctype?: string | undefined;
  formmethod?: string | undefined;
  formnovalidate?: false | true | "false" | "true" | undefined;
  formtarget?: string | undefined;
  name?: string | undefined;
  onClick?: (event: MouseEvent): void | ((event: MouseEvent) => void)[] | undefined;
  activeColor?: "default" | "link" | "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "danger" | "success" | "warning" | "primary" | "secondary" | "collab" | "ai" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-tertiary" | "air-selection" | "air-secondary-no-accent" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-boost" | 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?: "dark" | "light" | "normal" | undefined;
  /**
   * @deprecated Same as `depth` — no effect on the `air-*` colours.
   * @removed 3.0.0
   */
  activeDepth?: "dark" | "light" | "normal" | undefined;
  /**
   * @default 'md'
   */
  size?: "sm" | "md" | "xs" | "lg" | "xss" | "xl" | 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 DashboardSearchButton component
 */
interface DashboardSearchButtonSlots {
  leading(): any;
  default(): any;
  trailing(): any;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    dashboardSearchButton: {
      slots: {
        base: '',
        baseLine: '',
        label: '',
        trailing: 'hidden lg:flex items-center gap-0.5 ms-auto'
      },
      variants: {
        collapsed: {
          true: {
            baseLine: 'ps-[5px] pe-[5px]',
            label: 'hidden',
            trailing: 'lg:hidden'
          }
        }
      }
    }
  }
})
```

## Sitemap

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