v2.8.0

DashboardSearch

A ready-to-use CommandPalette component for your dashboard.

Usage

The DashboardSearch component extends the CommandPalette component, so you can pass any property such as icon, placeholder, etc.

Use it inside the default slot of the DashboardGroup component:

layouts/dashboard.vue
<template>
  <B24DashboardGroup>
    <B24DashboardSidebar>
      <B24DashboardSearchButton />
    </B24DashboardSidebar>

    <B24DashboardSearch />

    <slot />
  </B24DashboardGroup>
</template>
You can open the CommandPalette by pressing K, by using the DashboardSearchButton component or by using a v-model:open directive.

Shortcut

Use the shortcut prop to change the shortcut used in defineShortcuts to open the ContentSearch component. Defaults to meta_k ( K).

app.vue
<template>
  <B24DashboardSearch
    v-model:search-term="searchTerm"
    shortcut="meta_k"
    :groups="groups"
    :fuse="{ resultLimit: 42 }"
  />
</template>

Color Mode

By default, a group of commands will be added to the command palette so you can switch between light and dark mode. This will only take effect if the colorMode is not forced in a specific page which can be achieved through definePageMeta:

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

You can disable this behavior by setting the color-mode prop to false:

app.vue
<template>
  <B24DashboardSearch
    v-model:search-term="searchTerm"
    :color-mode="false"
    :groups="groups"
    :fuse="{ resultLimit: 42 }"
  />
</template>

API

Props

Prop Default Type
size'md' "sm" | "md" | "xs" | "lg" | "xss" | "xl"
closetrueboolean | Omit<ButtonProps, LinkPropsKeys>

Display a close button in the input (useful when inside a Modal for example). { size: 'sm', color: 'air-tertiary-no-accent' }

inputtrueboolean | Omit<InputProps<AcceptableValue, ModelModifiers>, "modelValue" | "defaultValue">

Configure the input or hide it with false. { fixed: true }

shortcut'meta_k' string

Keyboard shortcut to open the search (used by defineShortcuts)

fuse{ fuseOptions: { ignoreLocation: true, useTokenSearch: true, threshold: 0.1, keys: ['label', 'description', 'suffix'] }, resultLimit: 12, matchAllWhenSearchEmpty: true } UseFuseOptions<CommandPaletteItem>

Options for useFuse passed to the CommandPalette.

searchDelay100 number

Delay (in milliseconds) before the search term is passed to Fuse (debounced). Useful for large datasets where running fuzzy search on every keystroke is the bottleneck — the input stays responsive while Fuse only re-runs after typing settles. Set to 0 to disable.

colorModetrueboolean

When true, the theme command will be added to the groups.

title string
transitiontrueboolean

Animate the modal when opening or closing.

description string
overlaytrueboolean

Render an overlay behind the modal.

content DialogContentProps & Partial<EmitsToProps<DialogContentImplEmits>>

The content of the modal.

dismissiblefalseboolean

When false, the modal will not close when clicking outside or pressing escape.

fullscreenfalseboolean

When true, the modal will take up the full screen.

modalboolean

The modality of the dialog When set to true,
interaction with outside elements will be disabled and only dialog content will be visible to screen readers.

portaltrue string | false | true | HTMLElement

Render the modal in a portal.

unmountOnHidetrueboolean

When set to false, the dialog content will not be unmounted when closed, but instead hidden with CSS.
Useful for SEO or when you want to improve performance by not remounting the component on every open.

iconicons.searchIconComponent

The icon displayed in the input. Set to false to hide the icon.

trailingIconicons.searchIconComponent

The icon displayed on the right side of the input.

loadingboolean

When true, the loading icon will be displayed.

autofocustrueboolean

Automatically focus the input when component is mounted.

disabledboolean

When true, prevents the user from interacting with listbox

selectedIconicons.checkIconComponent

The icon displayed when an item is selected.

childrenIconicons.chevronRightIconComponent

The icon displayed when an item has children.

placeholdert('commandPalette.placeholder') string

The placeholder text for the input.

closeIconicons.closeIconComponent

The icon displayed in the close button.

backtrueboolean | Omit<ButtonProps, LinkPropsKeys>

Display a button to navigate back in history. { color: 'air-tertiary-accent' }

backIconicons.arrowLeftIconComponent

The icon displayed in the back button.

highlightOnHoverboolean

When true, hover over item will trigger highlight

labelKey'label' string

The key used to get the label from the item.

descriptionKey'description' string

The key used to get the description from the item.

preserveGroupOrderfalseboolean

Whether to preserve the order of groups as defined in the groups prop when filtering. When false, groups will appear based on item matches.

virtualizefalseboolean | { overscan?: number ; estimateSize?: number | ((index: number) => number) | undefined; } | undefined

Enable virtualization for large lists. Note: when enabled, all groups are flattened into a single list due to a limitation of Reka UI (https://github.com/unovue/reka-ui/issues/1885).

groups CommandPaletteGroup<CommandPaletteItem>[]
openfalseboolean
searchTerm'' string
b24ui { modal?: SlotClass; input?: SlotClass; } & { root?: SlotClass; input?: SlotClass; close?: SlotClass; back?: SlotClass; content?: SlotClass; footer?: SlotClass; viewport?: SlotClass; group?: SlotClass; empty?: SlotClass; label?: SlotClass; item?: SlotClass; itemLeadingIcon?: SlotClass; itemLeadingAvatar?: SlotClass; itemLeadingAvatarSize?: SlotClass; itemLeadingChip?: SlotClass; itemLeadingChipSize?: SlotClass; itemTrailing?: SlotClass; itemTrailingIcon?: SlotClass; itemTrailingHighlightedIcon?: SlotClass; itemTrailingKbds?: SlotClass; itemTrailingKbdsSize?: SlotClass; itemWrapper?: SlotClass; itemLabel?: SlotClass; itemLabelBase?: SlotClass; itemLabelPrefix?: SlotClass; itemLabelSuffix?: SlotClass; itemDescription?: SlotClass; }

Slots

Slot Type
empty{ searchTerm?: string | undefined; }
footer{ b24ui: object; }
back{ b24ui: object; }
close{ b24ui: object; }
item{ item: CommandPaletteItem; index: number; b24ui: object; }
item-leading{ item: CommandPaletteItem; index: number; b24ui: object; }
item-label{ item: CommandPaletteItem; index: number; b24ui: object; }
item-description{ item: CommandPaletteItem; index: number; b24ui: object; }
item-trailing{ item: CommandPaletteItem; index: number; b24ui: object; }
group-label{ group: CommandPaletteGroup<CommandPaletteItem>; label: string; b24ui: object; }
content{ close: () => void; }

Emits

Event Type
update:open[value: boolean]
update:searchTerm[value: string]

Expose

When accessing the component via a template ref, you can use the following:

NameType
commandPaletteRefRef<InstanceType<typeof B24CommandPalette> | null>

Theme

https://github.com/bitrix24/b24ui/tree/main/src/theme/dashboard-search.ts
export default {
  slots: {
    modal: 'p-0 pt-0 pb-[10px]',
    input: ''
  },
  variants: {
    fullscreen: {
      false: {
        modal: 'sm:max-w-[768px] h-full sm:h-[436px]'
      }
    },
    size: {
      xss: {},
      xs: {},
      sm: {},
      md: {},
      lg: {},
      xl: {}
    }
  },
  defaultVariants: {
    size: 'md'
  }
}