Autocomplete
A Base UI autocomplete composed with Notion-style menu groups, items, labels, and separators.
Autocomplete Default
<Autocomplete items={groups} open autoHighlight="always" openOnInputClick>
<AutocompleteInput placeholder="Search workspace..." />
<AutocompleteContent>
<AutocompleteEmpty>No matches found.</AutocompleteEmpty>
<AutocompleteList>
{(group) => (
<AutocompleteGroup key={group.label} items={group.items}>
<AutocompleteLabel title={group.label} />
<AutocompleteCollection>
{(item) => (
<AutocompleteItem
key={item}
value={item}
label={item}
icon={group.icon}
>
<MenuItemAction className="text-xs text-muted">
{group.label.slice(0, -1)}
</MenuItemAction>
</AutocompleteItem>
)}
</AutocompleteCollection>
</AutocompleteGroup>
)}
</AutocompleteList>
</AutocompleteContent>
</Autocomplete>Installation
pnpm add @notion-kit/uiExamples
Popover Menu
Use AutocompleteContent variant="inline" when another primitive owns the overlay positioning. This keeps existing popover menus as Popover + Autocomplete.
Autocomplete Popover
<Popover>
<PopoverTrigger
render={
<Button variant="hint" size="sm">
Open menu
</Button>
}
/>
<PopoverContent>
<Autocomplete items={groups} open autoHighlight="always" openOnInputClick>
<AutocompleteInput placeholder="Search workspace..." />
<AutocompleteContent variant="inline">
<AutocompleteEmpty>No matches found.</AutocompleteEmpty>
<AutocompleteList>
{(group) => (
<AutocompleteGroup key={group.label} items={group.items}>
<AutocompleteLabel title={group.label} />
<AutocompleteCollection>
{(item) => (
<AutocompleteItem
key={item}
value={item}
label={item}
icon={group.icon}
>
<MenuItemAction className="text-xs text-muted">
{group.label.slice(0, -1)}
</MenuItemAction>
</AutocompleteItem>
)}
</AutocompleteCollection>
</AutocompleteGroup>
)}
</AutocompleteList>
</AutocompleteContent>
</Autocomplete>
</PopoverContent>
</Popover>Anatomy
<Autocomplete>
<AutocompleteInput />
<AutocompleteContent>
<AutocompleteEmpty />
<AutocompleteList>
<AutocompleteGroup>
<AutocompleteLabel />
<AutocompleteCollection>
<AutocompleteItem />
</AutocompleteCollection>
</AutocompleteGroup>
</AutocompleteList>
</AutocompleteContent>
</Autocomplete>For grouped root items, render groups from AutocompleteList:
<Autocomplete items={groups}>
<AutocompleteInput />
<AutocompleteContent>
<AutocompleteEmpty />
<AutocompleteList>
{(group) => (
<AutocompleteGroup items={group.items}>
<AutocompleteLabel title={group.label} />
<AutocompleteCollection>
{(item) => <AutocompleteItem value={item} label={item} />}
</AutocompleteCollection>
</AutocompleteGroup>
)}
</AutocompleteList>
</AutocompleteContent>
</Autocomplete>API Reference
Autocomplete
The Base UI autocomplete root. It owns the input value, filtering, highlight state, and item collection.
Prop
Type
AutocompleteInput
The search input uses Base UI Input and Clear. It includes a search icon and shows the native clear button when the input has text. Use an uncontrolled root unless the query also drives application behavior.
default renders a bordered field with inset spacing. flat renders a full-width header with a bottom divider. Both styles include the search icon and native clear button.
Prop
Type
Other input props, including ref, render, and accessible labels, follow Base UI Input. AutocompleteInputProps exports this contract.
The former search, clear, and onCancel props and standalone AutocompleteClear export are removed. Observe changes through the root's onValueChange when the application needs the query. Native clearing uses that same callback.
AutocompleteContent
The popup surface. Floating content is positioned by Base UI; inline content renders in-flow for composed menus.
Prop
Type
AutocompleteList
The scrollable list viewport. When the root receives grouped items, pass a render function as children and render one AutocompleteGroup per group.
Prop
Type
AutocompleteCollection
Renders the filtered items from the nearest root or group.
Prop
Type
AutocompleteGroup
Groups related autocomplete items with menu spacing.
Prop
Type
For flat root items, keep the visual group item-less and let AutocompleteCollection read the root filtered items.
AutocompleteLabel
A non-interactive label used to title a group of items.
Prop
Type
AutocompleteItem
A single selectable autocomplete row. Extends the shared MenuItem visual props.
Prop
Type
Use MenuItemAction as trailing content for metadata, status, or shortcuts.
AutocompleteEmpty
Content shown only when Base UI reports an empty filtered result set.
AutocompleteSeparator
A visual divider between autocomplete groups.
AutocompleteTrigger
Optional trigger for autocomplete compositions that need a trigger affordance.
AutocompleteStatus
Displays Base UI autocomplete status text.