Autocomplete

Autocomplete is a component used to display suggestions in response to user text input.

Usage

import { Autocomplete } from "@yamada-ui/react"
<Autocomplete.Root>
  <Autocomplete.Group>
    <Autocomplete.Label />
    <Autocomplete.Option />
  </Autocomplete.Group>
</Autocomplete.Root>

Grouping Options

Use items

Use Query

Change Variants

Change Sizes

Set Default Value

To set a default value, specify a value for defaultValue.

Set Default Input Value

To set a default input value, specify a string for defaultInputValue.

Enable Multiple Selection

To enable multiple selection, set multiple to true.

Limit Maximum Selections

To limit the maximum number of selections, specify a number for max.

Change Separator

To change the separator, specify a string for separator. By default, , is set.

Allow Custom Value

To allow input of value not in the list, set allowCustomValue to true.

Change Offset

To change the offset, specify a value for gutter or offset.

Change Animation

To change the animation, specify "block-start" or "inline-end" for animationScheme. By default, "scale" is set.

Change Placement

To change the placement, specify "start" or "end-end" for placement. By default, "end" is set.

Blocking Scroll

To block scrolling, set blockScrollOnMount to true.

Open Dropdown On Focus

To open the dropdown on focus, set openOnFocus to true.

Close Dropdown On Scroll

To close the dropdown on scroll, set closeOnScroll to true.

Handle opening the dropdown on change

To handle the event of opening the dropdown on change, set a function to openOnChange.

Handle closing the dropdown on change

To handle the event of closing the dropdown on change, set a function to closeOnChange.

Disable Open Dropdown On Click

To disable opening the dropdown on click, set openOnClick to false.

Disable Focus After Clear

To disable focus after clear, set focusOnClear to false.

Disable Close On Select

To disable closing the dropdown on select, set closeOnSelect to false.

Disable Close On Outside Click

To disable closing dropdown when clicking outside, set closeOnBlur to false.

Disable Close On Esc

To disable closing the dropdown with the Esc key, set closeOnEsc to false.

Disable Clear Button

To disable the clear button, set clearable to false.

Disable Options

To disable specific options, set disabled to true.

Disable

To disable, set disabled to true.

Read-Only

To make read-only, set readOnly to true.

Invalid

To make invalid, set invalid to true.

Change Border Color

To customize focus and error border colors, set colors for focusBorderColor or errorBorderColor.

Customize Empty Message

Customize Icons

Customize Option Icons

Customize Multiple Selection Display

Control

Props

Accessibility

Currently, this section is being updated due to the migration of v2.