Usage
The ContentSearchButton component is used to open the ContentSearch modal.
<template>
<UContentSearchButton />
</template>
It extends the Button component, so you can pass any property such as color
, variant
, size
, etc.
<template>
<UContentSearchButton variant="subtle" />
</template>
color="neutral"
and variant="outline"
when not collapsed, variant="ghost"
when collapsed.Collapsed
Use the collapsed
prop to show the button's label and kbds. Defaults to true
.
<template>
<UContentSearchButton :collapsed="false" />
</template>
Kbds
Use the kbds
prop to display keyboard keys in the button. Defaults to ['meta', 'K']
to match the default shortcut of the ContentSearch component.
<template>
<UContentSearchButton :collapsed="false" :kbds="['alt', 'O']" />
</template>
API
Props
Prop | Default | Type |
---|---|---|
icon |
|
The icon displayed in the button. |
label |
|
The label displayed in the button. |
color |
|
The color of the button. |
variant |
The variant of the button. Defaults to 'outline' when not collapsed, 'ghost' when collapsed. | |
size |
| |
collapsed |
|
Whether the button is collapsed. |
kbds |
|
The keyboard keys to display in the button.
|
ui |
|
Slots
Slot | Type |
---|---|
leading |
|
default |
|
trailing |
|
Theme
export default defineAppConfig({
uiPro: {
contentSearchButton: {
slots: {
base: '',
trailing: 'hidden lg:flex items-center gap-0.5 ms-auto'
}
}
}
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
uiPro: {
contentSearchButton: {
slots: {
base: '',
trailing: 'hidden lg:flex items-center gap-0.5 ms-auto'
}
}
}
})
]
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import uiPro from '@nuxt/ui-pro/vite'
export default defineConfig({
plugins: [
vue(),
uiPro({
uiPro: {
contentSearchButton: {
slots: {
base: '',
trailing: 'hidden lg:flex items-center gap-0.5 ms-auto'
}
}
}
})
]
})