v2.1.8
/
  • Get Started
  • Components
  • Composables
  • Typography
  • GitHub
  • Layout
  • App
  • Container
  • Error
  • SidebarLayout
  • Element
  • Advice
  • Alert
  • Avatar
  • AvatarGroup
  • Badge
  • Banner
  • Button
  • Calendar
  • Card
  • Chip
  • Collapsible
  • Countdown
  • FieldGroup
  • Kbd
  • Progress
  • Separator
  • Skeleton
  • Form
  • Checkbox
  • CheckboxGroup
  • ColorPicker
  • FileUpload
  • Form
  • FormField
  • Input
  • InputDate
  • InputMenu
  • InputNumber
  • InputTags
  • InputTime
  • PinInput
  • RadioGroup
  • Range
  • Select
  • SelectMenu
  • Switch
  • Textarea
  • Data
  • Accordion
  • DescriptionList
  • Empty
  • Table
  • TableWrapper
  • Timeline
  • User
  • Navigation
  • Breadcrumb
  • CommandPalette
  • Link
  • NavigationMenu
  • Pagination
  • Stepper
  • Tabs
  • Overlay
  • ContextMenu
  • DropdownMenu
  • Modal
  • Popover
  • Slideover
  • Toast
  • Tooltip
  • Page
  • PageCard
  • PageColumns
  • PageGrid
  • PageLinks
  • PageList
  • Dashboard
  • DashboardGroup
  • DashboardSearch
  • DashboardSearchButton
  • AI Chat
  • soonChatMessage
  • soonChatMessages
  • soonChatPalette
  • soonChatPrompt
  • soonChatPromptSubmit
  • Content
  • ContentSearch
  • ContentSearchButton
  • ContentSurround
  • ContentToc
  • Color Mode
  • ColorModeAvatar
  • ColorModeButton
  • ColorModeImage
  • ColorModeSelect
  • ColorModeSwitch
  • i18n
  • LocaleSelect
  • b24icons
  • b24jssdk
Use our Nuxt starter
v2.1.8
  • Docs
  • Components
  • Composables
  • Typography

DashboardSearch

A ready-to-use Command Palette component for your dashboard.
GitHub
CommandPalette
Nuxt UI
We are still updating this page. Some data may be missing here — we will complete it shortly.

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>
    <B24SidebarLayout>
      <template #navbar>
        <B24NavbarSection>
          <B24DashboardSearchButton />
        </B24NavbarSection>
      </template>
  
      <B24DashboardSearch />
  
      <slot />
    </B24SidebarLayout>
  </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
iconicons.searchIconComponent

The icon displayed in the input.

placeholdert('commandPalette.placeholder') string

The placeholder text for the input.

autofocustrueboolean

Automatically focus the input when component is mounted.

loadingboolean

When true, the loading icon will be displayed.

closetrueboolean | Partial<ButtonProps>

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

closeIconicons.closeIconComponent

The icon displayed in the close button.

shortcut'meta_k' string

Keyboard shortcut to open the search (used by defineShortcuts)

groups CommandPaletteGroup<CommandPaletteItem>[]
fuse{} UseFuseOptions<CommandPaletteItem>

Options for useFuse passed to the CommandPalette.

colorModetrueboolean

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

title string
description string
overlaytrueboolean

Render an overlay behind the modal.

transitiontrueboolean

Animate the modal when opening or closing.

content DialogContentProps & Partial<EmitsToProps<DialogContentImplEmits>>

The content of the modal.

  • disableOutsidePointerEvents?: boolean

    When true, hover/focus/click interactions will be disabled on elements outside the DismissableLayer. Users will need to click twice on outside elements to interact with them: once to close the DismissableLayer, and again to trigger the element.

  • onEscapeKeyDown?: ((event: KeyboardEvent) => void)
  • onPointerDownOutside?: ((event: PointerDownOutsideEvent) => void)
  • onFocusOutside?: ((event: FocusOutsideEvent) => void)
  • onInteractOutside?: ((event: PointerDownOutsideEvent | FocusOutsideEvent) => void)
  • onOpenAutoFocus?: ((event: Event) => void)
  • onCloseAutoFocus?: ((event: Event) => void)
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.

openfalseboolean
searchTerm'' string
b24ui { modal?: ClassNameValue; input?: ClassNameValue; } & { root?: ClassNameValue; input?: ClassNameValue; close?: ClassNameValue; back?: ClassNameValue; content?: ClassNameValue; footer?: ClassNameValue; viewport?: ClassNameValue; group?: ClassNameValue; empty?: ClassNameValue; label?: ClassNameValue; item?: ClassNameValue; itemLeadingIcon?: ClassNameValue; itemLeadingAvatar?: ClassNameValue; itemLeadingAvatarSize?: ClassNameValue; itemLeadingChip?: ClassNameValue; itemLeadingChipSize?: ClassNameValue; itemTrailing?: ClassNameValue; itemTrailingIcon?: ClassNameValue; itemTrailingHighlightedIcon?: ClassNameValue; itemTrailingKbds?: ClassNameValue; itemTrailingKbdsSize?: ClassNameValue; itemWrapper?: ClassNameValue; itemLabel?: ClassNameValue; itemDescription?: ClassNameValue; itemLabelBase?: ClassNameValue; itemLabelPrefix?: ClassNameValue; itemLabelSuffix?: ClassNameValue; }
  • modal?: ClassNameValue
  • input?: ClassNameValue
  • root?: ClassNameValue
  • close?: ClassNameValue
  • back?: ClassNameValue
  • content?: ClassNameValue
  • footer?: ClassNameValue
  • viewport?: ClassNameValue
  • group?: ClassNameValue
  • empty?: ClassNameValue
  • label?: ClassNameValue
  • item?: ClassNameValue
  • itemLeadingIcon?: ClassNameValue
  • itemLeadingAvatar?: ClassNameValue
  • itemLeadingAvatarSize?: ClassNameValue
  • itemLeadingChip?: ClassNameValue
  • itemLeadingChipSize?: ClassNameValue
  • itemTrailing?: ClassNameValue
  • itemTrailingIcon?: ClassNameValue
  • itemTrailingHighlightedIcon?: ClassNameValue
  • itemTrailingKbds?: ClassNameValue
  • itemTrailingKbdsSize?: ClassNameValue
  • itemWrapper?: ClassNameValue
  • itemLabel?: ClassNameValue
  • itemDescription?: ClassNameValue
  • itemLabelBase?: ClassNameValue
  • itemLabelPrefix?: ClassNameValue
  • itemLabelSuffix?: ClassNameValue
This component also supports all native <button> HTML attributes.

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; }
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

app.config.ts
export default defineAppConfig({
  b24ui: {
    dashboardSearch: {
      slots: {
        modal: 'p-0 pt-0 pb-[10px]',
        input: ''
      },
      variants: {
        fullscreen: {
          false: {
            modal: 'sm:max-w-[768px] sm:h-[436px]'
          }
        }
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'

export default defineConfig({
  plugins: [
    vue(),
    bitrix24UIPluginVite({
      b24ui: {
        dashboardSearch: {
          slots: {
            modal: 'p-0 pt-0 pb-[10px]',
            input: ''
          },
          variants: {
            fullscreen: {
              false: {
                modal: 'sm:max-w-[768px] sm:h-[436px]'
              }
            }
          }
        }
      }
    })
  ]
})

DashboardGroup

A fixed-layout dashboard container with sidebar state management and persistent UI state.

DashboardSearchButton

A pre-styled button that opens the Dashboard Search modal.

On this page

  • Usage
    • Shortcut
    • Color Mode
  • API
    • Props
    • Slots
    • Emits
    • Expose
  • Theme
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24