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.Use the collapsed prop to show the button's label and kbds. Defaults to true.
<template>
<UContentSearchButton :collapsed="false" />
</template>
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>
| Prop | Default | Type |
|---|---|---|
as |
The element or component this component should render as when not a link. | |
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. | |
collapsed |
|
Whether the button is collapsed. |
tooltip |
|
Display a tooltip on the button when is collapsed with the button label.
This has priority over the global
|
kbds |
|
The keyboard keys to display in the button.
|
to |
Route Location the link should navigate to when clicked on.
| |
target |
Where to display the linked URL, as the name for a browsing context. | |
trailingSlash |
An option to either add or remove trailing slashes in the | |
autofocus | ||
disabled |
| |
form |
| |
formaction |
| |
formenctype |
| |
formmethod |
| |
formnovalidate |
| |
formtarget |
| |
name |
| |
type |
|
The type of the button when not a link. |
value |
| |
download |
| |
hreflang |
| |
media |
| |
ping |
| |
referrerpolicy |
| |
active |
Force the link to be active independent of the current route. | |
activeColor |
| |
activeVariant |
| |
size |
|
|
square |
Render the button with equal padding on all sides. | |
block |
Render the button full width. | |
loadingAuto |
Set loading state automatically based on the | |
avatar |
Display an avatar on the left side.
| |
leading |
When | |
leadingIcon |
Display an icon on the left side. | |
trailing |
When | |
trailingIcon |
Display an icon on the right side. | |
loading |
When | |
loadingIcon |
|
The icon when the |
ui |
|
| Slot | Type |
|---|---|
leading | |
default | |
trailing |
|
export default defineAppConfig({
ui: {
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({
ui: {
contentSearchButton: {
slots: {
base: '',
trailing: 'hidden lg:flex items-center gap-0.5 ms-auto'
}
}
}
})
]
})