Import
Basic Usage
Sub-components
Autocomplete.Root
Groups all parts of the autocomplete. Doesn’t render its own HTML element. Key Props:items: Array of items or groups. Can be flat array or array with{ label, items }structurevalue: Controlled input valuedefaultValue: Uncontrolled default input valueonValueChange: Called when input value changesmode: Behavior mode -'list'|'both'|'inline'|'none'(default:'list')list: Items filtered dynamically, input stays as typedboth: Items filtered + inline autocompletioninline: Static items + inline autocompletionnone: Static items, no autocompletion
open: Controlled popup open statedefaultOpen: Uncontrolled default open stateonOpenChange: Called when popup opens/closesfilter: Custom filter functionautoHighlight: Whether to highlight first match (false|true|'always')keepHighlight: Whether to preserve highlight when pointer leaves (default:false)highlightItemOnHover: Whether hovering highlights items (default:true)disabled: Whether component is disabled (default:false)name: Form field namerequired: Whether field is required (default:false)readOnly: Whether input is read-only (default:false)itemToStringValue: Convert object items to stringonItemHighlighted: Called when item is highlighted/unhighlightedsubmitOnItemClick: Whether selecting item submits form (default:false)openOnInputClick: Whether clicking input opens popup (default:false)
Autocomplete.Trigger
Container for the input and clear button.Autocomplete.Input
The text input element. Renders an<input> element.
Autocomplete.Clear
Button to clear the current input value.Autocomplete.Portal
Portals the popup to a different part of the DOM (default:document.body).
Autocomplete.Positioner
Positions the popup relative to the trigger.Autocomplete.Popup
The container for the list of items.Autocomplete.List
Scrollable list container for items.Autocomplete.Item
An individual item in the list. Renders a<div> by default.
Props:
value: The value this item representsdisabled: Whether this item is disabled
Autocomplete.Empty
Displayed when no items match the filter.Autocomplete.Group
Groups related items together.Autocomplete.GroupLabel
Label for a group of items.Autocomplete.Arrow
Arrow pointing to the trigger.Autocomplete.Backdrop
Backdrop element shown whenmodal={true}.