---
title: Autocomplete
description: "`Autocomplete` is a component used to display suggestions in response to user text input."
links:
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/autocomplete
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-autocomplete--basic
---
```tsx
アグモン
ガブモン
テントモン
ピヨモン
ゴマモン
パルモン
パタモン
テイルモン
```
## Usage
```tsx
import { Autocomplete } from "@yamada-ui/react"
```
```tsx
import { Autocomplete } from "@/components/ui"
```
```tsx
import { Autocomplete } from "@workspaces/ui"
```
```tsx
```
### Grouping Options
```tsx
成長期
アグモン
ガブモン
テントモン
ピヨモン
ゴマモン
パルモン
パタモン
テイルモン
グレイモン
ガルルモン
カブテリモン
バードラモン
イッカクモン
トグモン
エンジェモン
メタルグレイモン
ワーガルルモン
アトラーカブテリモン
ガルダモン
ズドモン
リリモン
ホーリーエンジェモン
エンジェウーモン
ウォーグレイモン
メタルガルルモン
ヘラクルカブテリモン
ホウオウモン
ヴァイクモン
ロゼモン
ゴッドドラモン
ホーリードラモン
```
### Use items
```tsx
const items = useMemo(
() => [
{ label: "オメガモン", value: "オメガモン" },
{ label: "ディアボロモン", value: "ディアボロモン" },
{
items: [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
label: "成長期",
},
{
items: [
{ label: "グレイモン", value: "グレイモン" },
{ label: "ガルルモン", value: "ガルルモン" },
{ label: "カブテリモン", value: "カブテリモン" },
{ label: "バードラモン", value: "バードラモン" },
{ label: "イッカクモン", value: "イッカクモン" },
{ label: "トグモン", value: "トグモン" },
{ label: "エンジェモン", value: "エンジェモン" },
],
label: "成熟期",
},
{
items: [
{ label: "メタルグレイモン", value: "メタルグレイモン" },
{ label: "ワーガルルモン", value: "ワーガルルモン" },
{ label: "アトラーカブテリモン", value: "アトラーカブテリモン" },
{ label: "ガルダモン", value: "ガルダモン" },
{ label: "ズドモン", value: "ズドモン" },
{ label: "リリモン", value: "リリモン" },
{ label: "ホーリーエンジェモン", value: "ホーリーエンジェモン" },
{ label: "エンジェウーモン", value: "エンジェウーモン" },
],
label: "完全体",
},
{
items: [
{ label: "ウォーグレイモン", value: "ウォーグレイモン" },
{ label: "メタルガルルモン", value: "メタルガルルモン" },
{ label: "ヘラクルカブテリモン", value: "ヘラクルカブテリモン" },
{ label: "ホウオウモン", value: "ホウオウモン" },
{ label: "ヴァイクモン", value: "ヴァイクモン" },
{ label: "ロゼモン", value: "ロゼモン" },
{ label: "ゴッドドラモン", value: "ゴッドドラモン" },
{ label: "ホーリードラモン", value: "ホーリードラモン" },
],
label: "究極体",
},
],
[],
)
return
```
### Use Query
```tsx
const items = useMemo(
() => [
{
label: (
<>
アグモン
>
),
query: "アグモン",
value: "アグモン",
},
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return
```
### Change Variants
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
{(variant) => (
)}
)
```
### Change Sizes
```tsx preview functional
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
{(size) => (
)}
)
```
### Set Default Value
To set a default value, specify a value for `defaultValue`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Set Default Input Value
To set a default input value, specify a string for `defaultInputValue`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Enable Multiple Selection
To enable multiple selection, set `multiple` to `true`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return
```
### Limit Maximum Selections
To limit the maximum number of selections, specify a number for `max`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Change Separator
To change the separator, specify a string for `separator`. By default, `,` is set.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Allow Custom Value
To allow input of value not in the list, set `allowCustomValue` to `true`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
console.log("value:", value)}
/>
)
```
### Change Offset
To change the offset, specify a value for `gutter` or `offset`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Change Animation
To change the animation, specify `"block-start"` or `"inline-end"` for `animationScheme`.
By default, `"scale"` is set.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
{(animationScheme) => (
)}
)
```
### Change Placement
To change the placement, specify `"start"` or `"end-end"` for `placement`. By default, `"end"` is set.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Blocking Scroll
To block scrolling, set `blockScrollOnMount` to `true`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Close Dropdown On Scroll
To close the dropdown on scroll, set `closeOnScroll` to `true`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Handle opening the dropdown on change
To handle the event of opening the dropdown on change, set a function to `openOnChange`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
ev.target.value.length > 2}
items={items}
placeholder="Select a digimon"
/>
)
```
### Handle closing the dropdown on change
To handle the event of closing the dropdown on change, set a function to `closeOnChange`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
!ev.target.value.length}
items={items}
placeholder="Select a digimon"
/>
)
```
### Disable Open Dropdown On Focus
To disable opening the dropdown on focus, set `openOnFocus` to `false`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Disable Open Dropdown On Click
To disable opening the dropdown on click, set `openOnClick` to `false`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Disable Focus After Clear
To disable focus after clear, set `focusOnClear` to `false`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Disable Close On Select
To disable closing the dropdown on select, set `closeOnSelect` to `false`.
```tsx
const items = useMemo(
() => [
{ closeOnSelect: true, label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Disable Close On Outside Click
To disable closing dropdown when clicking outside, set `closeOnBlur` to `false`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Disable Close On Esc
To disable closing the dropdown with the Esc key, set `closeOnEsc` to `false`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Disable Clear Button
To disable the clear button, set `clearable` to `false`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Disable Options
To disable specific options, set `disabled` to `true`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ disabled: true, label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return
```
### Disable
To disable, set `disabled` to `true`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
{(variant) => (
)}
)
```
### Read-Only
To make read-only, set `readOnly` to `true`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
{(variant) => (
)}
)
```
### Invalid
To make invalid, set `invalid` to `true`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
{(variant) => (
)}
)
```
### Change Border Color
To customize focus and error border colors, set colors for `focusBorderColor` or `errorBorderColor`.
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Customize Empty Message
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
### Customize Icons
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
}
placeholder="Select a digimon"
items={items}
/>
)
```
### Customize Option Icons
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
}}
/>
)
```
### Customize Multiple Selection Display
```tsx
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
(
{label}
)}
/>
)
```
### Control
```tsx
const [value, setValue] = useState("アグモン")
const items = useMemo(
() => [
{ label: "アグモン", value: "アグモン" },
{ label: "ガブモン", value: "ガブモン" },
{ label: "テントモン", value: "テントモン" },
{ label: "ピヨモン", value: "ピヨモン" },
{ label: "ゴマモン", value: "ゴマモン" },
{ label: "パルモン", value: "パルモン" },
{ label: "パタモン", value: "パタモン" },
{ label: "テイルモン", value: "テイルモン" },
],
[],
)
return (
)
```
## Props
### Autocomplete.Root
| Prop | Default | Type | Description |
| ---------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | `"md"` | `"lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. |
| `variant` | `"outline"` | `"filled" \| "flushed" \| "outline" \| "plain"` | The variant of the component. |
| `allowCustomValue` | `false` | `boolean` | If `true`, the autocomplete will allow custom value. |
| `animationScheme` | `"scale"` | `"none" \| "scale" \| SimplePlacement` | The animation of the element. |
| `autoUpdate` | `true` | `boolean` | If `true`, automatically updates the position of the floating element when necessary. |
| `blockScrollOnMount` | `false` | `boolean` | If `true`, scrolling will be disabled on the `body` when the modal opens. |
| `clearable` | `true` | `boolean` | If `true`, display the clear icon. |
| `clearIcon` | - | `ReactNode` | The icon to be used in the clear button. |
| `closeOnBlur` | `true` | `boolean` | If `true`, the popover will close when you blur out it by clicking outside or tabbing out. |
| `closeOnChange` | `false` | `((ev: ChangeEvent) => boolean) \| boolean` | If `true`, the autocomplete will be closed when the input value changes. |
| `closeOnEsc` | `true` | `boolean` | If `true`, the popover will hide on pressing Esc key. |
| `closeOnScroll` | `false` | `boolean` | If `true`, the popover will hide on scroll. |
| `closeOnSelect` | `true` | `boolean` | If `true`, the list element will be closed when value is selected. |
| `contentProps` | - | `AutocompleteContentProps` | Props for content element. |
| `defaultInputValue` | - | `string` | The initial value of the input. |
| `defaultOpen` | - | `boolean` | If `true`, the element will be initially opened. |
| `defaultValue` | - | `Multiple extends true ? string[] : string` | The initial value of the autocomplete. |
| `disabled` | `false` | `boolean` | If `true`, the combobox will be disabled. |
| `duration` | `0.2` | `MotionTransitionProps["duration"]` | The animation duration. |
| `elementProps` | - | `InputGroup.ElementProps` | The props for the end element. |
| `elements` | - | `{ floating?: HTMLElement \| null \| undefined; reference?: HTMLButtonElement \| null \| undefined }` | Object containing the reference and floating elements. |
| `emptyIcon` | - | `ReactNode` | The icon to be used in the empty element. |
| `emptyMessage` | `"No results found"` | `ReactNode` | The message displayed when the search yields no hits. |
| `emptyProps` | - | `AutocompleteEmptyProps` | Props for empty element. |
| `errorBorderColor` | - | `"-moz-initial" \| "ActiveBorder" \| "ActiveCaption" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" \| "amber.400" \| "amber.50" \| "amber.500" ...` | The border color when the input is invalid. |
| `filter` | - | `AutocompleteFilter` | The function to filter the items. |
| `flip` | `true` | `boolean` | If `true`, the popper will change its placement and flip when it's about to overflow its boundary area. |
| `focusBorderColor` | - | `"-moz-initial" \| "ActiveBorder" \| "ActiveCaption" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" \| "amber.400" \| "amber.50" \| "amber.500" ...` | The border color when the input is focused. |
| `focusOnClear` | `true` | `boolean` | If `true`, the input will be focused when the clear icon is clicked. |
| `groupProps` | - | `Omit` | Props for group element. |
| `gutter` | `8` | `number` | The distance or margin between the reference and popper. It is used internally to create an `offset` modifier. |
| `icon` | - | `ReactNode` | The icon to be used in the autocomplete. |
| `iconProps` | - | `AutocompleteIconProps` | Props for icon element. |
| `inputProps` | - | `HTMLStyledProps<"input">` | The props for the input element. |
| `inputValue` | - | `string` | The value of the input. |
| `invalid` | `false` | `boolean` | If `true`, the field will be invalid. |
| `items` | `[]` | `ComboboxItem[]` | If provided, generate options based on items. |
| `matcher` | - | `AutocompleteMatcher` | The function to match the items. |
| `matchWidth` | `false` | `boolean` | If `true`, the popper will match the width of the reference at all times. It's useful for `autocomplete`, `date-picker` and `select` patterns. |
| `max` | - | `number` | The maximum selectable value. |
| `middleware` | - | `(false \| { name: string; options?: any; fn: (state: { x: number; y: number; placement: Placement; platform: Platform; strategy: Strategy; initialPlacement: Placement; middlewareData: MiddlewareData; rects: ElementRects; elements: Elements; }) => Promisable<...>; } \| null \| undefined)[]` | Array of middleware objects to modify the positioning or provide data for rendering. |
| `multiple` | `false` | `Multiple` | If `true`, the autocomplete will be multiple. |
| `name` | - | `string` | The `name` attribute of the input element. |
| `offset` | - | `[number, number]` | The main and cross-axis offset to displace popper element from its reference element. |
| `onChange` | - | `(value: Multiple extends true ? string[] : string) => void` | The callback invoked when value state changes. |
| `onClose` | - | `() => void \| Promise` | Callback invoked to close the element. |
| `onInputChange` | - | `(value: string) => void` | The callback invoked when input value state changes. |
| `onOpen` | - | `() => void \| Promise` | Callback invoked to open the element. |
| `open` | - | `boolean` | If `true`, the element will be opened. |
| `openOnChange` | `true` | `((ev: ChangeEvent) => boolean) \| boolean` | If `true`, the autocomplete will be opened when the input value changes. |
| `openOnClick` | `true` | `boolean` | If `true`, the combobox will be opened when click on the field. |
| `openOnEnter` | `true` | `boolean` | If `true`, the combobox will be opened when enter is pressed. |
| `openOnFocus` | `true` | `boolean` | If `true`, the autocomplete will be opened when the input is focused. |
| `openOnSpace` | `true` | `boolean` | If `true`, the combobox will be opened when space is pressed. |
| `optionProps` | - | `Omit` | Props for option element. |
| `placeholder` | - | `string` | The placeholder for autocomplete. |
| `placement` | `"end"` | `Direction` | The placement of the popper relative to its reference. |
| `platform` | - | `Platform` | Custom or extended platform object. |
| `preventOverflow` | `true` | `boolean` | If `true`, will prevent the popper from being cut off and ensure it's visible within the boundary area. |
| `readOnly` | `false` | `boolean` | If `true`, the combobox will be readonly. |
| `render` | - | `(props: AutocompleteRenderProps) => ReactNode` | The function to render the selected items. |
| `required` | `false` | `boolean` | If `true`, the field will be required. |
| `rootProps` | - | `InputGroup.RootProps` | Props for root element. |
| `selectFocusRef` | - | `RefObject` | The `ref` of the element that should receive focus when selected. |
| `selectOnSpace` | `true` | `boolean` | If `true`, the item will be selected when space is pressed. |
| `separator` | `","` | `string` | The visual separator between each value. |
| `strategy` | `"absolute"` | `Strategy` | The CSS positioning strategy to use. |
| `transferFocus` | `true` | `boolean` | If `true`, the focus will be transferred to the popover content when the tab key is pressed. |
| `value` | - | `Multiple extends true ? string[] : string` | The value of the autocomplete. |
| `whileElementsMounted` | - | `(reference: HTMLButtonElement, floating: HTMLElement, update: () => void) => () => void` | A callback invoked when both the reference and floating elements are mounted, and cleaned up when either is unmounted. This is useful for setting up event listeners (e.g. pass `autoUpdate`). |
### Autocomplete.Group
| Prop | Default | Type | Description |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `label` | - | `ReactNode` | The label of the group. |
| `labelProps` | - | `AutocompleteLabelProps` | Props for the label component. |
### Autocomplete.Label
| Prop | Default | Type | Description |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
### Autocomplete.Option
| Prop | Default | Type | Description |
| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `closeOnSelect` | - | `boolean` | If `true`, the item will be closed when selected. |
| `disabled` | `false` | `boolean` | If `true`, the item will be disabled. |
| `icon` | - | `ReactNode` | The icon to be used in the autocomplete option. |
| `selected` | - | `boolean` | If `true`, the item will be selected. |
| `value` | - | `string` | The value of the item. |
## Accessibility
Currently, this section is being updated due to the migration of v2.