readOnly
readOnly locks the value and typing, not browsing. The popup can still open; selection stays blocked.
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
Groups all parts of the autocomplete. Doesn't render its own HTML element.
Props
defaultValue string | null —
- Name
defaultValue- Description
Uncontrolled initial value.
- Type
string | null
onValueChange function —
- Name
onValueChange- Description
Event handler called when the value changes.
- Type
((value: string | null, event: Event) => void) | undefined
inputValue string —
- Name
inputValue- Description
—
- Type
string | undefined
defaultInputValue string —
- Name
defaultInputValue- Description
—
- Type
string
onInputChange function —
- Name
onInputChange- Description
—
- Type
((value: string, event?: Event) => void) | undefined
open boolean —
- Name
open- Description
Whether the component is open (controlled).
- Type
boolean | undefined
defaultOpen boolean false
- Name
defaultOpen- Description
Whether the component is initially open (uncontrolled).
- Type
boolean- Default
false
onOpenChange function —
- Name
onOpenChange- Description
Event handler called when the open state changes.
- Type
((open: boolean, eventDetails: { reason: OpenChangeReason }) => void) | undefined
disabled boolean false
- Name
disabled- Description
Whether the control ignores user interaction.
- Type
boolean- Default
false
readOnly boolean false
- Name
readOnly- Description
Whether the user should be unable to choose a different option. The popup can still open and be browsed; selection and typing stay blocked.
- Type
boolean- Default
false
onOpenChangeComplete function —
- Name
onOpenChangeComplete- Description
Event handler called after any animations complete when the popup is opened or closed.
- Type
((open: boolean) => void) | undefined
loopFocus boolean true
- Name
loopFocus- Description
Whether to loop keyboard focus back to the input when the end of the list is reached while using the arrow keys. The first item can then be reached by pressing ArrowDown again from the input, or the last item can be reached by pressing ArrowUp from the input. The input is always included in the focus loop per [ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/). When disabled, focus does not move when on the last element and the user presses ArrowDown, or when on the first element and the user presses ArrowUp.
- Type
boolean- Default
true
filter AutocompleteFilter —
- Name
filter- Description
AutocompleteFilter function used to match items vs input query.
- Type
AutocompleteFilter
filteredItems string —
- Name
filteredItems- Description
Externally filtered item values; when set, skips internal filtering.
- Type
ReadonlyArray<string> | undefined
locale string —
- Name
locale- Description
Locale for default string filtering.
- Type
string | undefined
autoHighlight boolean false
- Name
autoHighlight- Description
Highlight the first matching item while filtering.
- Type
boolean- Default
false
highlightItemOnHover boolean true
- Name
highlightItemOnHover- Description
Highlight items on pointer move.
- Type
boolean- Default
true
onItemHighlighted function —
- Name
onItemHighlighted- Description
- Callback fired when an item is highlighted or unhighlighted.
- Receives the highlighted item value (or
undefinedif no item is highlighted) and event details with areasonproperty describing why the highlight changed. - The
reasoncan be:'keyboard': the highlight changed due to keyboard navigation. 'pointer': the highlight changed due to pointer hovering.'none': the highlight changed programmatically.
- Type
| ((value: string | null, eventDetails: { reason: 'none' | 'keyboard' | 'pointer' | 'filter' }) => void) | undefined
itemToStringLabel function —
- Name
itemToStringLabel- Description
—
- Type
((itemValue: string) => string) | undefined
itemToStringValue function —
- Name
itemToStringValue- Description
When the item values are objects (
<Autocomplete.Item value={object}>), this function converts the object value to a string representation for both display in the input and form submission. If the shape of the object is{ value, label }, the label will be used automatically without needing to specify this prop.- Type
((itemValue: string) => string) | undefined
isItemEqualToValue function —
- Name
isItemEqualToValue- Description
—
- Type
((itemValue: string, value: string) => boolean) | undefined
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the part is closed. |
data-disabled | Present when the part is disabled. |
data-open | Present when the part is open. |
data-readonly | Present when the control is read-only. |
Autocomplete.Arrow
Displays an element positioned against the anchor. Renders a <div> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the popup is closed. |
data-open | Present when the popup is open. |
Autocomplete.Backdrop
An overlay displayed beneath the popup. Renders a <div> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the popup is closed. |
data-open | Present when the popup is open. |
Autocomplete.Clear
Clears the value when clicked. Renders a <button> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-disabled | Present when the button is disabled. |
data-empty | Present on the element when applicable. |
data-hidden | Present on the element when applicable. |
Autocomplete.Collection
Renders filtered list items. Doesn't render its own HTML element. If rendering a flat list, pass a function child to the List component instead, which implicitly wraps it.
Props
Autocomplete.Empty
Renders its children only when the list is empty. Requires the items prop on the root component. Announces changes politely to screen readers. This component's root element must remain mounted in the DOM to announce changes consistently across screen readers. Avoid hiding or removing the component itself with display: none, hidden, aria-hidden, or conditional rendering. Prefer updating or conditionally rendering its children instead. Renders a <div> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-empty | Present on the element when applicable. |
Autocomplete.Group
Groups related items with the corresponding label. Renders a <div> element.
Props
Autocomplete.GroupLabel
An accessible label that is automatically associated with its parent group. Renders a <div> element.
Props
Autocomplete.Icon
An icon that indicates that the trigger button opens the popup. Renders a <span> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the part is closed. |
data-open | Present when the part is open. |
Autocomplete.Input
A text input to search for items in the list. Renders an <input> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the part is closed. |
data-disabled | Present when the component is disabled. |
data-open | Present when the part is open. |
data-readonly | Present when the component is readonly. |
Autocomplete.InputGroup
A wrapper for the input and its associated controls. Renders a <div> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the part is closed. |
data-disabled | Present when the component is disabled. |
data-open | Present when the part is open. |
Autocomplete.Item
An individual item in the list. Renders a <div> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-disabled | Present when the item is disabled. |
data-highlighted | Present when the item is highlighted. |
data-selected | Present when the item is selected. |
Autocomplete.ItemIndicator
Extends span HTML attributes.
Props
Data attributes
| Attribute | Description |
|---|---|
data-disabled | Present when the part is disabled. |
data-selected | Present when the item is selected. |
Autocomplete.Label
Extends label HTML attributes.
Props
Data attributes
| Attribute | Description |
|---|---|
data-disabled | Present when the part is disabled. |
Autocomplete.List
A list container for the items. Renders a <div> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the part is closed. |
data-open | Present when the part is open. |
Autocomplete.Popup
A container for the list. Renders a <div> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the popup is closed. |
data-ending-style | Present when the popup is animating out. |
data-open | Present when the popup is open. |
data-starting-style | Present when the popup begins animating in. |
Autocomplete.Portal
A portal element that moves the popup to a different part of the DOM. By default, the portal element is appended to <body>. Renders a <div> element.
Props
container HTMLElement | string | null —
- Name
container- Description
A parent element to render the portal element into.
- Type
HTMLElement | string | null
keepMounted boolean false
- Name
keepMounted- Description
Whether to keep the portal mounted in the DOM while the popup is hidden.
- Type
boolean- Default
false
Autocomplete.Positioner
Positions the popup against the trigger. Renders a <div> element.
Props
side null 'bottom'
- Name
side- Description
Which side of the anchor element to align the popup against. May automatically change to avoid collisions.
- Type
null- Default
'bottom'
align HTML 'center'
- Name
align- Description
How to align the popup relative to the specified side.
- Type
HTML- Default
'center'
sideOffset popup 0
- Name
sideOffset- Description
Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment. The function takes a
dataobject parameter with the following properties:data.anchor: the dimensions of the anchor element with propertieswidthandheight.data.positioner: the dimensions of the positioner element with propertieswidthandheight.data.side: which side of the anchor element the positioner is aligned against.data.align: how the positioner is aligned relative to the specified side.- Type
popup- Default
0
alignOffset ull; 0
- Name
alignOffset- Description
Additional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment. The function takes a
dataobject parameter with the following properties:data.anchor: the dimensions of the anchor element with propertieswidthandheight.data.positioner: the dimensions of the positioner element with propertieswidthandheight.data.side: which side of the anchor element the positioner is aligned against.data.align: how the positioner is aligned relative to the specified side.- Type
ull;- Default
0
collisionPadding t | null; list: HTMLElement | null; 5
- Name
collisionPadding- Description
Additional space to maintain from the edge of the collision boundary.
- Type
t | null; list: HTMLElement | null;- Default
5
collisionBoundary ll; }; export 'clipping-ancestors'
- Name
collisionBoundary- Description
An element or a rectangle that delimits the area that the popup is confined to.
- Type
ll; }; export- Default
'clipping-ancestors'
collisionAvoidance = { readonly val —
- Name
collisionAvoidance- Description
- Determines how to handle collisions when positioning the popup.
sidecontrols overflow on the preferred placement axis (top/bottomorleft/right):'flip': keep the requested side when it fits; otherwise try the opposite side - (
topandbottom, orleftandright). 'shift': never change side; keep the requested side and move the popup within the clipping boundary so it stays visible.'none': do not correct side-axis overflow.aligncontrols overflow on the alignment axis (start/center/end):'flip': keep side, but swapstartandendwhen the requested alignment overflows.'shift': keep side and requested alignment, then nudge the popup along the alignment axis to fit.'none': do not correct alignment-axis overflow.fallbackAxisSidecontrols fallback behavior on the perpendicular axis when the preferred axis cannot fit:'start': allow perpendicular fallback and try the logical start side first- (
topbeforebottom, orleftbeforerightin LTR). 'end': allow perpendicular fallback and try the logical end side first- (
bottombeforetop, orrightbeforeleftin LTR). 'none': do not fallback to the perpendicular axis. Whensideis'shift', explicitly settingalignonly supports'shift'or'none'.- If
alignis omitted, it defaults to'flip'.
- Determines how to handle collisions when positioning the popup.
- Type
= { readonly val
arrowPadding setV 5
- Name
arrowPadding- Description
Minimum distance to maintain between the arrow and the edges of the popup. Use it to prevent the arrow element from hanging out of the rounded corners of a popup.
- Type
setV- Default
5
sticky string false
- Name
sticky- Description
Whether to maintain the popup in the viewport after the anchor element was scrolled out of view.
- Type
string- Default
false
positionMethod string 'absolute'
- Name
positionMethod- Description
Maps to Floating UI strategy (
absolute|fixed).- Type
string, event?: Ev- Default
'absolute'
anchor function —
- Name
anchor- Description
Override the positioning anchor (element or virtual element).
- Type
): () => void; readonly highli
disableAnchorTracking object false
- Description
When
true, skip continuous layout tracking of the anchor (position once; no resize/scroll auto-updates beyond the initial compute).- Type
Entry[]- Default
false
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the popup is closed. |
data-open | Present when the popup is open. |
Autocomplete.Row
Displays a single row of items in a grid list. Enable grid on the root component to turn the listbox into a grid. Renders a <div> element.
Props
Autocomplete.Separator
A visual separator between items or groups. Renders a <div> element.
No component-specific props — HTML attributes and children only.
Autocomplete.Status
Displays a status message whose content changes are announced politely to screen readers. Useful for conveying the status of an asynchronously loaded list. This component's root element must remain mounted in the DOM to announce changes consistently across screen readers. Avoid hiding or removing the component itself with display: none, hidden, aria-hidden, or conditional rendering. Prefer updating or conditionally rendering its children instead. Renders a <div> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the part is closed. |
data-open | Present when the part is open. |
Autocomplete.Trigger
A button that opens the popup. Renders a <button> element.
Props
Data attributes
| Attribute | Description |
|---|---|
data-closed | Present when the part is closed. |
data-disabled | Present when the component is disabled. |
data-open | Present when the part is open. |
data-readonly | Present when the component is readonly. |
Autocomplete.Value
The current value of the autocomplete. Doesn't render its own HTML element.
Props