Skip to main content
196

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Android docs
FormsAndroid

Autocomplete

Select from application-provided search results with loading, empty, and retry feedback.

Public APILumenAutocompleteAndroid / Compose

Native example

Use Autocomplete

The application supplies filtered results with unique non-null values, owns request cancellation, and clears stale selection after query edits. React Native and Compose selection emit the option label before the selected value; SwiftUI updates bindings directly.

Autocomplete rendered in the Android phone emulator Lumen playground
Captured exampleAndroid phone emulator
kotlin
LumenAutocomplete(
    label = "Project",
    query = query,
    onQueryChange = { query = it; selectedProject = null },
    options = matchingProjects,
    value = selectedProject,
    onValueChange = { selectedProject = it },
    loading = searching,
    resultsErrorMessage = searchError,
    onRetry = ::retrySearch
)

Reference

Public API

The primary shared and platform-specific options exposed by LumenAutocomplete.

APIValues or typeDefaultDescription
labelStringRequiredNames the editable field.
query / onQueryChangeString / (String) -> UnitRequiredControls the editable search text.
optionsList<LumenAutocompleteOption<T>>RequiredSupplies current results with value, label, optional description, and enabled state.
value / onValueChangeT? / (T) -> Unitnull / RequiredControls selected result identity; option values must be unique and non-null.
modifierModifierModifierApplies layout and semantics to the dropdown container.
description / errorMessageString?nullShows supporting text or field validation.
loadingBooleanfalseShows loading feedback instead of stale results.
resultsErrorMessage / onRetryString? / (() -> Unit)?nullShows a result failure and optional application-owned retry.
loadingLabel / emptyLabel / retryLabelStringLoading results / No results / RetryLocalizes result status and recovery.
enabled / readOnlyBooleantrue / falseControls query edits and dismisses open results when editing becomes unavailable.

Native behavior

Design and accessibility

When to use it

The application supplies filtered results with unique non-null values, owns request cancellation, and clears stale selection after query edits. React Native and Compose selection emit the option label before the selected value; SwiftUI updates bindings directly.

Accessibility

Preserves native editable dropdown focus, selected and disabled option semantics, and announced loading, empty, and recovery states.

Shared component

Available on other platforms

React NativeApple / SwiftUI
Android docsCompose module