Nuxt UI v3 is officially released!

Components
Display an autocomplete input with real-time suggestions.

Usage

The InputMenu component renders by default an Input component and is based on the ui.input preset. You can use most of the Input props to configure the display such as color, variant, size, placeholder, icon, disabled, etc.

You can use the ui prop like the Input component to override the default config. The uiMenu prop can be used to override the default menu config.

Pass an array of strings or objects to the options prop to display in the menu.

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}
This component does not support multiple values. Use the SelectMenu component instead.

Objects

You can pass an array of objects to options and either compare on the whole object or use the by prop to compare on a specific key. You can configure which field will be used to display the label through the option-attribute prop that defaults to label. Additionally, you can use dot notation (e.g., user.name) to access nested object properties.

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

Use the search-attributes prop with an array of property names to search on each option object. Nested attributes can be accessed using dot.notation. When the property value is an array or object, these are cast to string so these can be searched within.

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

If you only want to select a single object property rather than the whole object as value, you can set the value-attribute property. This prop defaults to null.

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

Icon

The InputMenu has a button on the right to toggle the menu. Use the trailing-icon prop to set a different icon or change it globally in ui.inputMenu.default.trailingIcon. Defaults to i-heroicons-chevron-down-20-solid.

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

Use the selected-icon prop to set a different icon or change it globally in ui.inputMenu.default.selectedIcon. Defaults to i-heroicons-check-20-solid.

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}
Learn how to customize icons from the Input component.

Searchable

Attributes

Use the search-attributes prop with an array of property names to search on each option object. Nested attributes can be accessed using dot.notation. When the property value is an array or object, these are cast to string so these can be searched within.

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

Control the query

Use a v-model:query to control the search query.

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

Pass a function to the search prop to customize the search behavior and filter options according to your needs. The function will receive the query as its first argument and should return an array.

Use the debounce prop to adjust the delay of the function.

Use the searchLazy prop to control the immediacy of data requests.

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

Popper

Use the popper prop to customize the popper instance.

Arrow

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

Placement

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

Offset

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

Slots

option

Use the #option slot to customize the option content. You will have access to the option, active and selected properties in the slot scope.

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

option-empty

Use the #option-empty slot to customize the content displayed when the searchable prop is true and there is no options. You will have access to the query property in the slot scope.

You can also configure this globally through the ui.inputMenu.default.optionEmpty.label config. The token {query} will be replaced by query property. Defaults to No results for "{query}"..

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

empty

Use the #empty slot to customize the content displayed when there is no options. Defaults to No options..

You can also configure this globally through the ui.inputMenu.default.empty.label config. Defaults to No options..

{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}

Props

name
string
null
size
InputSize
null
"md""2xs""xs""sm""lg""xl"
search
(query: string) => any[] | Promise<any[]>
undefined
color
InputColor
config.default.color
"primary""white""gray""red""orange""amber""yellow""lime""green""emerald""teal""cyan""sky""blue""indigo""violet""purple""fuchsia""pink""rose"
icon
string
null
ui
{ wrapper?: string; base?: string; form?: string; rounded?: string; placeholder?: string; file?: DeepPartial<{ base: string; }, any>; size?: DeepPartial<{ '2xs': string; xs: string; sm: string; md: string; lg: string; xl: string; }, any>; gap?: DeepPartial<{ '2xs': string; xs: string; sm: string; md: string; lg: string; xl: string; }, any>; padding?: DeepPartial<{ '2xs': string; xs: string; sm: string; md: string; lg: string; xl: string; }, any>; leading?: DeepPartial<{ padding: { '2xs': string; xs: string; sm: string; md: string; lg: string; xl: string; }; }, any>; trailing?: DeepPartial<{ padding: { '2xs': string; xs: string; sm: string; md: string; lg: string; xl: string; }; }, any>; color?: DeepPartial<{ white: { outline: string; }; gray: { outline: string; }; }, any>; variant?: DeepPartial<{ outline: string; none: string; }, any>; icon?: DeepPartial<{ base: string; color: string; loading: string; size: { '2xs': string; xs: string; sm: string; md: string; lg: string; xl: string; }; leading: { wrapper: string; pointer: string; padding: { '2xs': string; xs: string; sm: string; md: string; lg: string; xl: string; }; }; trailing: { wrapper: string; pointer: string; padding: { '2xs': string; xs: string; sm: string; md: string; lg: string; xl: string; }; }; }, any>; default?: DeepPartial<{ size: string; color: string; variant: string; loadingIcon: string; }, any>; } & { [key: string]: any; } & { strategy?: Strategy; }
{}
id
string
null
modelValue
string | number | object | any[]
""
inputClass
string
null
variant
InputVariant
config.default.variant
"outline""none"
placeholder
string
null
loadingIcon
string
config.default.loadingIcon
leadingIcon
string
null
trailingIcon
string
configMenu.default.trailingIcon
by
string
undefined
popper
PopperOptions
{}
query
string
null
options
string[] | { [key: string]: any; disabled?: boolean; }[]
[]
selectedIcon
string
configMenu.default.selectedIcon
optionAttribute
string
"label"
valueAttribute
string
null
searchAttributes
unknown[]
null
debounce
number
200
uiMenu
{ container?: string; trigger?: string; width?: string; height?: string; base?: string; background?: string; shadow?: string; rounded?: string; padding?: string; ring?: string; empty?: string; option?: DeepPartial<{ base: string; rounded: string; padding: string; size: string; color: string; container: string; active: string; inactive: string; selected: string; disabled: string; empty: string; icon: { base: string; active: string; inactive: string; }; selectedIcon: { wrapper: string; padding: string; base: string; }; avatar: { base: string; size: AvatarSize; }; chip: { base: string; }; }, any>; transition?: DeepPartial<{ leaveActiveClass: string; leaveFromClass: string; leaveToClass: string; }, any>; popper?: DeepPartial<{ placement: string; }, any>; default?: DeepPartial<{ selectedIcon: string; trailingIcon: string; empty: { label: string; }; optionEmpty: { label: string; }; }, any>; arrow?: DeepPartial<{ ring: string; background: string; base: string; rounded: string; shadow: string; placement: string; }, any>; } & { [key: string]: any; } & { strategy?: Strategy; }
{}
onChange
(...args: any[]) => any
onClose
(...args: any[]) => any
onUpdate:modelValue
(...args: any[]) => any
onUpdate:query
(...args: any[]) => any
onOpen
(...args: any[]) => any
required
boolean
false
disabled
boolean
false
leading
boolean
false
nullable
boolean
false
trailing
boolean
false
loading
boolean
false
padded
boolean
true
searchLazy
boolean
false

Config

Use the ui prop to override the input config and the uiMenu prop to override the menu config.
{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}
{
  "message": "You should use slots with <ContentRenderer>",
  "value": {},
  "excerpt": false,
  "tag": "div"
}