DashboardSearchButton

A pre-styled Button to open the DashboardSearch modal.

Usage

The DashboardSearchButton component is used to open the DashboardSearch modal.

<template>
  <UDashboardSearchButton />
</template>

It extends the Button component, so you can pass any property such as color, variant, size, etc.

<template>
  <UDashboardSearchButton label="Search..." variant="subtle" />
</template>
The button defaults to color="neutral" and variant="outline".

Kbds

Use the kbds prop to display keyboard keys in the button. Defaults to ['meta', 'K'] to match the default shortcut of the DashboardSearch component.

<template>
  <UDashboardSearchButton :kbds="['alt', 'O']" />
</template>

Collapsed

Use the collapsed prop to collapse the button when the DashboardSidebar is collapsed.

<template>
  <UDashboardSearchButton collapsed />
</template>

API

Props

Prop Default Type
as

'button'

any

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

icon

appConfig.ui.icons.search

string

The icon displayed in the button.

label

'Search...'

string

The label displayed in the button.

color

'neutral'

"error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"

variant

'outline'

"link" | "solid" | "outline" | "soft" | "subtle" | "ghost"

size

"md" | "xs" | "sm" | "lg" | "xl"

collapsed

false

boolean

Whether the button is collapsed.

kbds

["meta", "k"]

(string | undefined)[] | KbdProps[]

The keyboard keys to display in the button. { variant: 'subtle' }

disabled

boolean

ui

Partial<{ base: string; trailing: string; }> & PartialString<{ base: string[]; label: string; leadingIcon: string; leadingAvatar: string; leadingAvatarSize: string; trailingIcon: string; }>

Slots

Slot Type
leading

{}

default

{}

trailing

{}

Theme

app.config.ts
export default defineAppConfig({
  uiPro: {
    dashboardSearchButton: {
      slots: {
        base: '',
        trailing: 'flex items-center gap-0.5 ms-auto'
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    vue(),
    ui({
      uiPro: {
        dashboardSearchButton: {
          slots: {
            base: '',
            trailing: 'flex items-center gap-0.5 ms-auto'
          }
        }
      }
    })
  ]
})