StylishAutocomplete

fun StylishAutocomplete(value: String, onValueChange: (String) -> Unit, options: List<String>, modifier: Modifier = Modifier, label: String = "", placeholder: String = "", onOptionSelect: (String) -> Unit? = null, match: (String, String) -> Boolean = { query, option -> option.contains(query, ignoreCase = true) }, maxSuggestions: Int = 6, enabled: Boolean = true, isError: Boolean = false, errorMessage: String? = null, shape: Shape = RoundedCornerShape(DefaultStylishDimensions.connectedCornerRadius), width: Dp = 320.dp)

A text field with a filtered suggestion dropdown — the web "AutoComplete" pattern from Ant Design and MUI.

As the user types, options are filtered with match and up to maxSuggestions matches are shown in a popover below the field. Selecting a suggestion calls onOptionSelect (and onValueChange with the selected text).

Parameters

value

The current field text.

onValueChange

Called as the user types.

options

The full candidate list to filter against.

modifier

Modifier applied to the root box.

label

Optional field label.

placeholder

Optional placeholder text.

onOptionSelect

Optional callback invoked with the selected suggestion.

match

Predicate deciding whether option matches query. Defaults to a case-insensitive substring match.

maxSuggestions

Maximum suggestions shown. Defaults to 6.

enabled

When false, the field is read-only and suggestions are hidden.

isError

Whether the field renders in its error state.

errorMessage

Optional supporting error text.

shape

Corner shape of the field and popover. Defaults to RoundedCornerShape with DefaultStylishDimensions.connectedCornerRadius.

width

Width of the suggestion popover. Defaults to 320 dp.