base-ui-svelte

Autocomplete

An input that suggests values as the user types.

View as Markdown

API Reference

Props mirror Base UI React where applicable, adapted for Svelte 5. Native HTML attributes for the rendered element are also accepted unless noted.

Autocomplete.Root

Extends div HTML attributes.

PropertyTypeDefaultDescription
valuestring | null | undefinedControlled value.
defaultValuestring | nullUncontrolled initial value.
onValueChange((value: string | null, event: Event) => void) | undefinedEvent handler called when the value changes.
inputValuestring | undefined
defaultInputValuestring
onInputChange((value: string, event?: Event) => void) | undefined
openboolean | undefinedWhether the component is open (controlled).
defaultOpenbooleanWhether the component is initially open (uncontrolled).
onOpenChange((open: boolean, eventDetails: { reason: OpenChangeReason }) => void) | undefinedEvent handler called when the open state changes.
disabledbooleanfalseWhether the control ignores user interaction.
filterboolean
childrenSnippet< [{ value: string | null; inputValue: string; open: boolean; disabled: boolean }] >Content rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-disabledPresent when the part is disabled.
data-openPresent when the part is open.

Autocomplete.Arrow

Extends span HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Autocomplete.Backdrop

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Autocomplete.Clear

Extends button HTML attributes.

PropertyTypeDefaultDescription
disabledbooleanfalseWhether the control ignores user interaction.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-emptyPresent on the element when applicable.
data-hiddenPresent on the element when applicable.

Autocomplete.Empty

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-emptyPresent on the element when applicable.

Autocomplete.Group

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Autocomplete.GroupLabel

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Autocomplete.Icon

Extends span HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Autocomplete.Input

Extends input HTML attributes.

PropertyTypeDefaultDescription
disabledbooleanfalseWhether the control ignores user interaction.
Data attributeDescription
data-closedPresent when the part is closed.
data-disabledPresent when the part is disabled.
data-openPresent when the part is open.

Autocomplete.InputGroup

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-disabledPresent when the part is disabled.
data-openPresent when the part is open.

Autocomplete.Item

Extends div HTML attributes.

PropertyTypeDefaultDescription
valuestringControlled value.
labelstring
disabledbooleanfalseWhether the control ignores user interaction.
childrenSnippet<[{ selected: boolean; highlighted: boolean; disabled: boolean }]>Content rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-highlightedPresent when the item is highlighted.
data-selectedPresent when the item is selected.

Autocomplete.ItemIndicator

Extends span HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-selectedPresent when the item is selected.

Autocomplete.Label

Extends label HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.

Autocomplete.List

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Autocomplete.Popup

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-ending-stylePresent while the exit animation can run.
data-openPresent when the part is open.
data-starting-stylePresent while the enter animation can run.

Autocomplete.Portal

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Autocomplete.Positioner

Extends div HTML attributes.

PropertyTypeDefaultDescription
sideSide
alignAlign
sideOffsetnumber
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Autocomplete.Row

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Autocomplete.Separator

Extends div HTML attributes.

No component-specific props — HTML attributes and children only.

Autocomplete.Status

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Autocomplete.Trigger

Extends button HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
disabledbooleanfalseWhether the control ignores user interaction.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-disabledPresent when the part is disabled.
data-openPresent when the part is open.