Skip to content
// EFFECT DAYS 2026

Autocomplete unstable

An input that suggests completions from a list as the user types, and keeps whatever text the user enters.

Autocomplete is headless: it owns the keyboard and pointer behaviour, the filtering, focus, placement and the data attributes, and the consumer draws the markup. The consumer owns whether the popup is open and the input's text, passes them as open and value, and stores what the RequestedOpen, RequestedClose and Updated events ask for. Unlike a Combobox it selects nothing: the text is the value, and picking an item puts its label in the input and closes the popup. items lists every suggestion with its label. The autocomplete filters them and hands back autocomplete.items, the ones to draw.

Anatomy

Part Element
inputGroup <div> around the input and its buttons, the anchor
input <input>, the combobox
trigger <button> that toggles the popup
icon <span> inside the trigger
clear <button> that clears the text
label <div> that names the input, the list and the popup
value <span> that shows the text
backdrop <div>, a manual popover under the positioner
positioner <div>, a manual popover placed by the autocomplete
popup <div> inside the positioner
arrow <div> inside the popup
list <div> around the items
row <div> around a row of items, with grid
item <div>, one per drawn value, inside the list
group <div> around items
groupLabel <div> inside a group
separator <div> between items
empty <div>, its children drawn while no item matches
status <div>, a live region for a message such as a count

Each part takes the consumer's builder and returns it with the part applied, and the consumer adds the children. item takes an options object, { element, value }, and keys its element with the value, and group and groupLabel take { element, group }, where group is the group of the items inside. clear takes { element } and returns undefined while the text is empty; a keepMounted field keeps it drawn. empty drops its children while the list has items, so the live region stays in the page.

Draw autocomplete.items, not items: it's the filtered list, which keeps its contents while the popup animates out. autocomplete.groups splits it by each item's group, dropping groups with nothing left, and each group's rows splits it again by row, for grid. Every value drawn with item has to be in items or filteredItems.

Focus stays in the input: the highlighted item is named by aria-activedescendant, and presses on the trigger, the clear button and the items don't take focus. In a Field, draw it as autocomplete.input(field.control(h.input)) and name it with field.label.

mode sets how the text and the list relate. With "list" the text filters the items. With "both" it filters them too, and the arrow keys show the highlighted item's label in the input until the user types, picks or closes the popup; value keeps the typed text, which is what filters. "inline" shows the label the same way without filtering, and "none" neither filters nor shows it. When the typed text starts the label, the rest is selected so the next key replaces it. Input types that can't select text, such as "email", keep the typed text.

With inline, the list is drawn without a popup, as in a command palette: it's always expanded, and the arrow keys move through it while open is false.

The positioner is a manual popover, so it renders in the top layer and needs no portal. The browser gives a popover a border, padding, a background and overflow: auto, so reset those on the positioner and the backdrop and style the popup instead.

With topLayer: false, the backdrop and the positioner render in place as ordinary elements, hidden while closed, and the popup is placed and clipped inside its containing block, as Positioning describes. The backdrop covers that block, and the autocomplete is never modal.

CSS variables

Set on the positioner:

  • --anchor-width, --anchor-height: the anchor's size
  • --available-width, --available-height: the space between the anchor and the edge of the collision boundary, for a max-height

Set on the popup: --transform-origin, the point the popup grows from.

Data attributes

Each present with an empty value or absent, except data-side, data-align, data-popup-side and data-orientation, which hold a value:

  • input: data-popup-open, data-pressed, data-popup-side, data-list-empty, data-disabled, data-readonly, data-required
  • inputGroup: as on the input, without data-required
  • trigger: as on the input
  • icon: data-popup-open
  • clear: data-popup-open, data-disabled, data-visible
  • backdrop: data-open / data-closed, data-starting-style, data-ending-style
  • positioner: as on the backdrop, and data-side, data-align, data-anchor-hidden, data-empty
  • popup: as on the positioner
  • arrow: as on the backdrop, and data-side, data-align, data-uncentered
  • list: data-empty
  • item: data-highlighted, data-disabled
  • separator: data-orientation

Keyboard

In the input, ArrowDown and ArrowUp open the popup, and then move the highlight; with autoHighlight opening highlights the first or, for ArrowUp, the last item. Past either end the highlight leaves the list, and the next press wraps around; with loopFocus: false it stops at the ends. Enter picks the highlighted item, and with nothing highlighted it closes the popup on its keyup, leaving the keydown to submit a form. Space picks the highlighted item while the input is empty. Escape closes the popup, and on a closed autocomplete clears the text. Typing opens the popup. Keys pressed while an IME composes text are left alone. With grid, ArrowLeft and ArrowRight move between the items of a row once one is highlighted. They follow dir or, without it, the nearest DirectionProvider above the autocomplete or, without one, the CSS direction of the popup or an inline list.

Form

The input is the form control: name, form and required go on it, so the text is submitted and validated as typed. With inputInPopup the input isn't always drawn, so the trigger is wrapped in a display: contents span that holds a visually hidden input with them and the text instead. With submitOnItemClick, picking an item submits that form, the one named by form or around the autocomplete, once the picked label is drawn.

Limits

Props can't hold functions, so filter names a matcher and a consumer with its own filter passes the result as filteredItems, or sets filter: "none" and filters the items it passes, as for results fetched while typing. makeAutocompleteFilter gives the autocomplete's matchers to a consumer's own filter. There are no default* props or refs, no portal, and items are { value, label } rather than any object.

Example A search box whose text is in the consumer's Model

import { UiSchema } from "effect/ui"
import { Html, HtmlServer } from "effect/ui/html"
import { Autocomplete } from "effect/ui/kit"
import { Effect, Schema } from "effect"
const tags = [
{ value: "effect", label: "effect" },
{ value: "schema", label: "schema" },
{ value: "stream", label: "stream" }
]
const SearchMessage = UiSchema.TaggedEnum({
RequestedOpenSuggestions: {},
RequestedCloseSuggestions: {},
UpdatedQuery: { query: Schema.String }
})
const Search = Html.component({
name: "Search",
model: Schema.Struct({ open: Schema.Boolean, query: Schema.String }),
message: SearchMessage
}).make({
init: () => ({ open: false, query: "str" }),
update: {
RequestedOpenSuggestions: ($) => $.evolve({ open: true }),
RequestedCloseSuggestions: ($) => $.evolve({ open: false }),
UpdatedQuery: ($, { query }) => $.evolve({ query })
},
view: (h, model) =>
h.form(
Autocomplete(h, {
props: { open: model.open, value: model.query, items: tags, name: "q" },
onEmit: {
RequestedOpen: () => SearchMessage.RequestedOpenSuggestions(),
RequestedClose: () => SearchMessage.RequestedCloseSuggestions(),
Updated: ({ value }) => SearchMessage.UpdatedQuery({ query: value }),
Highlighted: () => undefined,
Settled: () => undefined
},
view: (autocomplete) =>
h.div(
autocomplete.inputGroup(h.div).children(
autocomplete.input(h.input.attr("aria-label", "Search tags")),
autocomplete.clear({ element: h.button })?.children("ร—")
),
autocomplete.positioner(h.div).children(
autocomplete.popup(h.div).children(
autocomplete.empty(h.div).children("No tags"),
autocomplete.list(h.div).children(
autocomplete.items.map(({ label, value }) =>
autocomplete.item({ element: h.div, value }).children(label)
)
)
)
)
)
})
)
})
// The input is the form field, and holds the typed text.
const { html } = await Effect.runPromise(HtmlServer.renderToHtml(Search, {}))
if (!/<input[^>]* name="q"/.test(html) || !/<input[^>]* value="str"/.test(html)) {
throw new Error("the input doesn't hold the query")
}
19 exports Since v4.2.0 Source

Components

Since v4.2.0

An autocomplete: an input that suggests completions from a list as the user types.

Details

The parts also return plain values for markup that depends on them: open, mounted (the popup shows, through its exit transition), transitionStatus, inline, disabled, readOnly, required, side and align (where the popup ended up), highlighted (the value of the highlighted item), openMethod, which is null once the popup closes, items (the filtered items to draw), groups and listEmpty.

Each part writes the attributes and handles the events that the Combobox part of the same name does, listed under Combobox, over the ones the consumer set on the builder before the part. As nothing is selected, the items have no aria-selected. Without inputInPopup, the input also takes name, form and required.

It emits RequestedOpen, RequestedClose, Updated, Highlighted and Settled.

History restore saves nothing of it: after Back, forward or a reload it starts from init.

Signature

declare const Autocomplete: Headless<{
readonly align?: "start" | "end" | "center";
readonly alignOffset?: number;
readonly anchor?: string | {
readonly height: number;
readonly width: number;
readonly x: number;
readonly y: number;
};
readonly arrowPadding?: number;
readonly autoHighlight?: boolean | "always";
readonly collisionAvoidance?: {
readonly align?: "shift" | "none" | "flip";
readonly fallbackAxisSide?: "start" | "none" | "end";
readonly side?: "shift" | "none" | "flip";
};
readonly collisionBoundary?: "clipping-ancestors" | {
readonly height: number;
readonly width: number;
readonly x: number;
readonly y: number;
} | {
readonly id: string;
};
readonly collisionPadding?: number | {
readonly bottom?: number;
readonly left?: number;
readonly right?: number;
readonly top?: number;
};
readonly dir?: "ltr" | "rtl";
readonly disableAnchorTracking?: boolean;
readonly disabled?: boolean;
readonly dismissLabel?: string;
readonly filter?: "endsWith" | "startsWith" | "none" | "contains";
readonly filteredItems?: readonly Array<{
readonly disabled?: boolean;
readonly group?: string;
readonly label: string;
readonly row?: number;
value: string;
}>;
readonly form?: string;
readonly grid?: boolean;
readonly highlightItemOnHover?: boolean;
readonly holdExit?: boolean;
readonly id?: string;
readonly inline?: boolean;
readonly inputInPopup?: boolean;
readonly items: readonly Array<{
readonly disabled?: boolean;
readonly group?: string;
readonly label: string;
readonly row?: number;
value: string;
}>;
readonly keepHighlight?: boolean;
readonly limit?: number;
readonly locale?: string;
readonly loopFocus?: boolean;
readonly modal?: boolean;
readonly mode?: "both" | "none" | "list" | "inline";
readonly name?: string;
readonly open: boolean;
readonly openOnInputClick?: boolean;
readonly positionMethod?: "fixed" | "absolute";
readonly readOnly?: boolean;
readonly required?: boolean;
readonly side?: "left" | "right" | "top" | "bottom" | "inline-start" | "inline-end";
readonly sideOffset?: number;
readonly sticky?: boolean;
readonly submitOnItemClick?: boolean;
readonly topLayer?: boolean;
readonly value: string;
readonly virtualized?: boolean;
}, {
readonly _tag: "Updated";
readonly reason: "none" | "trigger-press" | "outside-press" | "escape-key" | "close-press" | "focus-out" | "input-press" | "item-press" | "list-navigation" | "input-change" | "input-clear" | "clear-press" | "cancel-open";
readonly value: string;
} | {
readonly _tag: "Settled";
readonly open: boolean;
} | {
readonly _tag: "RequestedOpen";
readonly reason: "none" | "trigger-press" | "outside-press" | "escape-key" | "close-press" | "focus-out" | "input-press" | "item-press" | "list-navigation" | "input-change" | "input-clear" | "clear-press" | "cancel-open";
} | {
readonly _tag: "RequestedClose";
readonly reason: "none" | "trigger-press" | "outside-press" | "escape-key" | "close-press" | "focus-out" | "input-press" | "item-press" | "list-navigation" | "input-change" | "input-clear" | "clear-press" | "cancel-open";
} | {
readonly _tag: "Highlighted";
readonly index: number;
readonly reason: "none" | "pointer" | "keyboard";
readonly value: string | null;
}, {
align: "start" | "end" | "center";
arrow: Part<"div", [], never>;
backdrop: Part<"div", [], never>;
clear: <B extends PartTarget<"button">>(__namedParameters: {
readonly element: B;
readonly keepMounted?: boolean;
}) => ReturnType<B["attr"]> | undefined & Pick<Part<"button", [], never>, "~R">;
disabled: boolean;
empty: Part<"div", [], never>;
group: <B extends PartTarget<"div">>(__namedParameters: {
readonly element: B;
readonly group: string;
}) => ReturnType<B["attr"]> & Pick<Part<"div", [group: string], never>, "~R">;
groupLabel: <B extends PartTarget<"div">>(__namedParameters: {
readonly element: B;
readonly group: string;
}) => ReturnType<B["attr"]> & Pick<Part<"div", [group: string], never>, "~R">;
groups: readonly Array<Group<string>>;
highlighted: string | null;
icon: Part<"span", [], never>;
inline: boolean;
input: Part<"input", [], never>;
inputGroup: Part<"div", [], never>;
item: <B extends Keyed<"div">>(__namedParameters: {
readonly element: B;
readonly value: string;
}) => ReturnType<B["attr"]> & Pick<Part<"div", [value: string], never>, "~R">;
items: readonly Array<{
readonly disabled?: boolean;
readonly group?: string;
readonly label: string;
readonly row?: number;
value: string;
}>;
label: Part<"div", [], never>;
list: Part<"div", [], never>;
listEmpty: boolean;
mounted: boolean;
open: boolean;
openMethod: "mouse" | "touch" | "pen" | "keyboard" | null;
popup: Part<"div", [], never>;
positioner: Part<"div", [], never>;
readOnly: boolean;
required: boolean;
row: Part<"div", [], never>;
separator: Part<"div", [], never>;
side: "left" | "right" | "top" | "bottom" | "inline-start" | "inline-end";
status: Part<"div", [], never>;
transitionStatus: TransitionStatus;
trigger: Part<"button", [], never>;
value: Part<"span", [], never>;
}, never, never, never, never, never, never, {
readonly active: string | null;
readonly activeByKey: boolean;
readonly autoFirst: boolean;
readonly chipsRtl: boolean;
readonly closeMethod: "mouse" | "touch" | "pen" | "keyboard" | null;
readonly closeQuery: string | null;
readonly completion: {
readonly from: string;
readonly label: string;
} | null;
readonly focusLeft: boolean;
readonly mounted: boolean;
readonly openMethod: "mouse" | "touch" | "pen" | "keyboard" | null;
readonly placement: {
readonly align: "start" | "end" | "center";
readonly anchorHidden: boolean;
readonly arrowUncentered: boolean;
readonly side: "left" | "right" | "top" | "bottom" | "inline-start" | "inline-end";
} | null;
readonly pressedItem: string | null;
readonly pressing: boolean;
readonly queryChanged: boolean;
readonly removing: {
readonly label: string;
readonly value: string;
} | null;
readonly rtl: boolean;
readonly saved: string | null;
readonly started: boolean;
readonly typeahead: {
readonly matched: number;
readonly typed: string;
readonly typedFrom: number;
};
}, {
readonly _tag: "RenderedFirstFrame";
} | {
readonly _tag: "FocusedOutside";
} | {
readonly _tag: "ClickedTrigger";
readonly pointerType: string;
} | {
readonly _tag: "FinishedTransition";
readonly open: boolean;
} | {
readonly _tag: "PressedOutside";
readonly pointerType: string;
} | {
readonly _tag: "PressedInput";
readonly pointerType: string;
} | {
readonly _tag: "PressedGroup";
readonly pointerType: string;
} | {
readonly _tag: "ChangedInput";
readonly composing: boolean;
readonly inputType: string;
readonly value: string;
} | {
readonly _tag: "PressedInputKey";
readonly chips: boolean;
readonly key: string;
} | {
readonly _tag: "ReleasedInputKey";
readonly key: string;
} | {
readonly _tag: "FocusedInput";
} | {
readonly _tag: "BlurredInput";
} | {
readonly _tag: "PressedTrigger";
readonly pointerType: string;
} | {
readonly _tag: "ReleasedTrigger";
} | {
readonly _tag: "PressedTriggerKey";
readonly key: string;
} | {
readonly _tag: "ClickedLabel";
} | {
readonly _tag: "FocusedFormInput";
} | {
readonly _tag: "Autofilled";
readonly value: string;
} | {
readonly _tag: "PressedClear";
} | {
readonly _tag: "RequestedChipRemoval";
readonly reason: "none" | "trigger-press" | "outside-press" | "escape-key" | "close-press" | "focus-out" | "input-press" | "item-press" | "list-navigation" | "input-change" | "input-clear" | "clear-press" | "cancel-open" | "chip-remove-press";
readonly value: string;
} | {
readonly _tag: "PressedChipArrow";
readonly key: string;
} | {
readonly _tag: "EnteredItem";
readonly value: string;
} | {
readonly _tag: "LeftItem";
} | {
readonly _tag: "PressedItem";
readonly value: string;
} | {
readonly _tag: "ReleasedItem";
readonly button: number;
readonly value: string;
} | {
readonly _tag: "ClickedItem";
readonly pointerType: string;
readonly value: string;
} | {
readonly _tag: "PressedDismiss";
} | {
readonly _tag: "CompletedWaitBeforeResetTyping";
} | {
readonly _tag: "ShowedPopup";
} | {
readonly _tag: "ChangedPlacement";
readonly placement: {
readonly align: "start" | "end" | "center";
readonly anchorHidden: boolean;
readonly arrowUncentered: boolean;
readonly side: "left" | "right" | "top" | "bottom" | "inline-start" | "inline-end";
};
} | {
readonly _tag: "ReleasedPointer";
readonly outside: boolean;
} | {
readonly _tag: "FoundDirection";
readonly rtl: boolean;
} | {
readonly _tag: "FoundChipsDirection";
readonly rtl: boolean;
}, QueryEntries<{}, {}>>

Constructors

The AutocompleteFilter for a locale, the runtime's when left out. It's cached, so calling it for each render is cheap.

Signature

declare function makeAutocompleteFilter(locale?: string): AutocompleteFilter

Example Filtering suggestions the consumer fetched

import { makeAutocompleteFilter } from "effect/ui/kit"
const filter = makeAutocompleteFilter("fr")
filter.contains("Crรจme brรปlรฉe", "creme") // true

Models

Since v4.2.0

Why an Autocomplete asks to open, close or change its text.

Signature

type AutocompleteChangeReason = typeof AutocompleteChangeReason.Type

AutocompleteEvents

type unstable
Since v4.2.0

What an Autocomplete emits.

Signature

type AutocompleteEvents = typeof AutocompleteEvents.Type

AutocompleteFilter

interface unstable
Since v4.2.0

The matchers an Autocomplete filters with, for a consumer's own filter.

Details

Each takes an item's text and the query, and ignores case, accents and punctuation. An empty query matches everything.

Signature

interface AutocompleteFilter extends TextFilter {}
Since v4.2.0

How an Autocomplete matches its items against the text.

Signature

type AutocompleteFilterMode = typeof AutocompleteFilterMode.Type

AutocompleteGroup

interface unstable
Since v4.2.0

A run of items to draw under one group label: the items whose group is key, in order, and the same items split into rows by their row.

Signature

interface AutocompleteGroup extends Group {}
Since v4.2.0

What moved the highlight.

Signature

type AutocompleteHighlightReason = typeof AutocompleteHighlightReason.Type

AutocompleteItem

type unstable
Since v4.2.0

One suggestion of an Autocomplete.

Signature

type AutocompleteItem = typeof AutocompleteItem.Type

AutocompleteMode

type unstable
Since v4.2.0

How an Autocomplete's text relates to its list.

Signature

type AutocompleteMode = typeof AutocompleteMode.Type

AutocompleteProps

type unstable
Since v4.2.0

The props of an Autocomplete.

Signature

type AutocompleteProps = typeof AutocompleteProps.Type
Since v4.2.0

Where an autocomplete's popup is in its transitions: "starting" for the first frame after it opens, "ending" while it closes, null otherwise.

Signature

type AutocompleteTransitionStatus = Engine.TransitionStatus

Schemas

Why an Autocomplete asks to open, close or change its text.

Details

  • "trigger-press": a press on the trigger
  • "input-press": a press on the input or the input group
  • "outside-press": a press outside the autocomplete and the popup, other than on a scrollbar
  • "item-press": an item was picked, with the pointer or the keyboard
  • "close-press": the visually hidden dismiss button in the popup, for screen readers
  • "escape-key": Escape in the input
  • "list-navigation": ArrowDown or ArrowUp opened the popup
  • "focus-out": focus left the autocomplete and the popup
  • "input-change": the user edited the input's text
  • "input-clear": the user emptied the input
  • "clear-press": the clear button
  • "cancel-open": the press that opened it was released away from the trigger and the popup
  • "none": anything else, such as Enter with nothing highlighted

Signature

declare const AutocompleteChangeReason: Literals<readonly ["trigger-press", "input-press", "outside-press", "item-press", "close-press", "escape-key", "list-navigation", "focus-out", "input-change", "input-clear", "clear-press", "cancel-open", "none"]>
Since v4.2.0

What an Autocomplete emits.

Details

  • RequestedOpen: asks for open to be true.
  • RequestedClose: asks for open to be false.
  • Updated: asks for value to be value, the new text. A pick asks for the picked label.
  • Highlighted: reports that the highlighted item changed, to value at index in autocomplete.items, or to none with null and -1. For a virtualized list to scroll to it.
  • Settled: reports that the popup's transitions ended, after it opened or closed.

Signature

declare const AutocompleteEvents: TaggedEnum<{
Highlighted: TaggedStruct<"Highlighted", {
readonly index: Number;
readonly reason: Literals<readonly ["keyboard", "pointer", "none"]>;
readonly value: NullOr<String>;
}>;
RequestedClose: TaggedStruct<"RequestedClose", {
readonly reason: Literals<readonly ["trigger-press", "input-press", "outside-press", "item-press", "close-press", "escape-key", "list-navigation", "focus-out", "input-change", "input-clear", "clear-press", "cancel-open", "none"]>;
}>;
RequestedOpen: TaggedStruct<"RequestedOpen", {
readonly reason: Literals<readonly ["trigger-press", "input-press", "outside-press", "item-press", "close-press", "escape-key", "list-navigation", "focus-out", "input-change", "input-clear", "clear-press", "cancel-open", "none"]>;
}>;
Settled: TaggedStruct<"Settled", {
readonly open: Boolean;
}>;
Updated: TaggedStruct<"Updated", {
readonly reason: Literals<readonly ["trigger-press", "input-press", "outside-press", "item-press", "close-press", "escape-key", "list-navigation", "focus-out", "input-change", "input-clear", "clear-press", "cancel-open", "none"]>;
readonly value: String;
}>;
}>

How an Autocomplete matches its items against the text.

Details

  • "contains": the label contains the text
  • "startsWith": the label starts with it
  • "endsWith": the label ends with it
  • "none": every item is drawn, for a consumer that filters items itself

Matching ignores case, accents and punctuation, in the locale.

Signature

declare const AutocompleteFilterMode: Literals<readonly ["contains", "startsWith", "endsWith", "none"]>

What moved the highlight: "keyboard", "pointer", or "none" for the autocomplete itself, as when it opens or the list changes.

Signature

declare const AutocompleteHighlightReason: Literals<readonly ["keyboard", "pointer", "none"]>
Since v4.2.0

One suggestion of an Autocomplete.

Details

  • value: what identifies the item, in Highlighted. Unique among the items.
  • label: the text matched while filtering, and put in the input when the item is picked.
  • disabled: the item can be highlighted but not picked.
  • group: the key of the group it's drawn in, for autocomplete.groups.
  • row: the row it's drawn in, for grid. Neighbouring items of a group with the same row share a row.

Signature

declare const AutocompleteItem: Struct<{
readonly disabled: optional<Boolean>;
readonly group: optional<String>;
readonly label: String;
readonly row: optional<Number>;
value: String;
}>
Since v4.2.0

How an Autocomplete's text relates to its list.

Details

  • "list": the text filters the items
  • "both": the text filters the items, and the arrow keys show the highlighted item's label in the input
  • "inline": every item is drawn, and the arrow keys show the highlighted item's label in the input
  • "none": every item is drawn, and the input only shows the text

Signature

declare const AutocompleteMode: Literals<readonly ["list", "both", "inline", "none"]>
Since v4.2.0

The props of an Autocomplete.

Details

  • open: whether the popup shows. The autocomplete only asks, with RequestedOpen and RequestedClose.
  • value: the input's text. The autocomplete only asks, with Updated.
  • items: every suggestion, in the order they're drawn.
  • mode: how the text relates to the list, as AutocompleteMode describes. "list" when left out.
  • filter: how the text matches the items, with mode "list" or "both". "contains" when left out.
  • filteredItems: the items to draw, from the consumer's own filter, in place of filter.
  • locale: the locale the filter compares in. The runtime's when left out.
  • limit: the most items drawn. All of them when left out.
  • autoHighlight: typing highlights the first match, so Enter picks it, and opening with the arrow keys highlights the first or last item. "always" also highlights the first item whenever the list shows. False when left out.
  • keepHighlight: the highlight stays when the pointer leaves the list. False when left out.
  • highlightItemOnHover: the pointer highlights the item it's over. True when left out.
  • loopFocus: the arrow keys go past the ends of the list and around. True when left out.
  • openOnInputClick: a press on the input opens the popup. False when left out.
  • submitOnItemClick: picking an item submits the autocomplete's form. False when left out.
  • inline: the list is drawn without a popup and is always expanded. False when left out.
  • inputInPopup: the input is drawn inside the popup, and the trigger is the combobox that opens it. The value part shows the text in the trigger. False when left out.
  • grid: the items are drawn in rows, by their row, and the list is a grid. False when left out.
  • virtualized: the consumer draws only some of the items, so the autocomplete doesn't scroll the highlighted one into view; scroll to it on Highlighted. False when left out.
  • disabled, readOnly, required, name, form: as on a native <input>, and put on the input. A read-only autocomplete opens and can be browsed but not changed.
  • id: the input's id, unless the builder has one. Generated when left out.
  • dir: the writing direction, for the horizontal arrow keys. When left out, the nearest DirectionProvider's or, without one, the CSS direction of the popup or an inline list.
  • modal: while open, the page doesn't scroll, a press outside only closes the popup, and the rest of the page is hidden from assistive technology. With inputInPopup, the popup is also a modal dialog that Tab doesn't leave. False when left out.
  • dismissLabel: the name of the visually hidden dismiss button in the popup. "Dismiss" when left out.
  • holdExit: keeps the closing popup shown, for an exit animation the consumer ends by clearing it.
  • the Positioning.PositionerFields, for the popup, topLayer: false among them to draw it in place, as the module describes. side is "bottom" when left out, and the anchor is the input group, or the input without one.

Signature

declare const AutocompleteProps: Struct<{
readonly align: optional<Literals<readonly ["start", "center", "end"]>>;
readonly alignOffset: optional<Number>;
readonly anchor: optional<Union<readonly [String, Struct<{
readonly height: Number;
readonly width: Number;
readonly x: Number;
readonly y: Number;
}>]>>;
readonly arrowPadding: optional<Number>;
readonly autoHighlight: optional<Union<readonly [Boolean, Literal<"always">]>>;
readonly collisionAvoidance: optional<Struct<{
readonly align: optional<Literals<readonly ["flip", "shift", "none"]>>;
readonly fallbackAxisSide: optional<Literals<readonly ["start", "end", "none"]>>;
readonly side: optional<Literals<readonly ["flip", "shift", "none"]>>;
}>>;
readonly collisionBoundary: optional<Union<readonly [Literal<"clipping-ancestors">, Struct<{
readonly id: String;
}>, Struct<{
readonly height: Number;
readonly width: Number;
readonly x: Number;
readonly y: Number;
}>]>>;
readonly collisionPadding: optional<Union<readonly [Number, Struct<{
readonly bottom: optional<Number>;
readonly left: optional<Number>;
readonly right: optional<Number>;
readonly top: optional<Number>;
}>]>>;
readonly dir: optional<Literals<readonly ["ltr", "rtl"]>>;
readonly disableAnchorTracking: optional<Boolean>;
readonly disabled: optional<Boolean>;
readonly dismissLabel: optional<String>;
readonly filter: optional<Literals<readonly ["contains", "startsWith", "endsWith", "none"]>>;
readonly filteredItems: optional<$Array<Struct<{
readonly disabled: optional<Boolean>;
readonly group: optional<String>;
readonly label: String;
readonly row: optional<Number>;
value: String;
}>>>;
readonly form: optional<String>;
readonly grid: optional<Boolean>;
readonly highlightItemOnHover: optional<Boolean>;
readonly holdExit: optional<Boolean>;
readonly id: optional<String>;
readonly inline: optional<Boolean>;
readonly inputInPopup: optional<Boolean>;
readonly items: $Array<Struct<{
readonly disabled: optional<Boolean>;
readonly group: optional<String>;
readonly label: String;
readonly row: optional<Number>;
value: String;
}>>;
readonly keepHighlight: optional<Boolean>;
readonly limit: optional<Number>;
readonly locale: optional<String>;
readonly loopFocus: optional<Boolean>;
readonly modal: optional<Boolean>;
readonly mode: optional<Literals<readonly ["list", "both", "inline", "none"]>>;
readonly name: optional<String>;
readonly open: Boolean;
readonly openOnInputClick: optional<Boolean>;
readonly positionMethod: optional<Literals<readonly ["absolute", "fixed"]>>;
readonly readOnly: optional<Boolean>;
readonly required: optional<Boolean>;
readonly side: optional<Literals<readonly ["top", "bottom", "left", "right", "inline-start", "inline-end"]>>;
readonly sideOffset: optional<Number>;
readonly sticky: optional<Boolean>;
readonly submitOnItemClick: optional<Boolean>;
readonly topLayer: optional<Boolean>;
readonly value: String;
readonly virtualized: optional<Boolean>;
}>