Skip to main content
196

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
React Native docs
FormsReact Native

Autocomplete

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

Public APILumenAutocompleteReact Native

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.

View captured React Native example
Autocomplete rendered in the Expo web renderer Lumen playground
Captured exampleExpo web renderer
tsx
import { useState } from 'react'
import { LumenAutocomplete } from '@santi020k/lumen-react-native'

const projects = [{ value: 'lumen', label: 'Lumen' }, { value: 'studio', label: 'Studio' }]
export function ProjectSearch() {
  const [query, setQuery] = useState('')
  const [selected, setSelected] = useState<string>()
  const matches = projects.filter(option => option.label.toLowerCase().includes(query.toLowerCase()))
  return <LumenAutocomplete label="Project" query={query}
    onQueryChange={next => { setQuery(next); setSelected(undefined) }}
    options={matches} value={selected} onValueChange={setSelected}
    emptyLabel="No projects" dismissLabel="Close results" />
}

Reference

Public API

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

APIValues or typeDefaultDescription
labelstringRequiredNames the search field.
query / onQueryChangestring / (string) => voidRequiredControls query text; the host filters results.
value / onValueChangestring | undefined / (string) => voidundefined / RequiredControls selection; clear stale selection in the query handler.
optionsreadonly LumenAutocompleteOption[]RequiredUnique string values with label, description and disabled state.
loading / resultsErrorMessage / onRetryboolean / string / () => voidfalse / undefined / undefinedHides stale results and offers application-owned recovery.
loadingLabel / emptyLabel / retryLabel / dismissLabelstringLoading results / No results / Retry / Close resultsLocalizes status and result dismissal.
ref / TextInput propsLumenTextInputRef / TextInputPropsundefinedForwards native input focus and supported input options.
description / errorMessagestringundefinedProvides localized supporting copy or host validation.
enabled / readOnlybooleantrue / falseBlocks changes without clearing controlled state.

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

Apple / SwiftUIAndroid / Compose
React Native docsNative primitives