typeAhead

fun RenderContext.typeAhead(styling: BasicParams.() -> Unit = {}, value: Store<String>? = null, items: Proposal, baseClass: StyleClass = StyleClass.None, id: String? = value?.id, prefix: String = "typeAhead", build: TypeAheadComponent.() -> Unit = {}): Input

The typeAhead factory function creates a TypeAheadComponent.

It offers the possibility to input some String and get some list of proposals to choose from. Internally this is achieved by adding some datalist to the input field.

The typical (and minimal) usage might look like this:

val proposals = listOf("Kotlin", "Scala", "Java", "OCaml", "Haskell").asProposals()
val choice = storeOf("")
typeAhead(value = choice, items = proposals) { }

See also

Parameters

styling

a lambda expression for declaring the styling as fritz2's styling DSL

value

optional Store that holds the data of the result

items
baseClass

optional CSS class that should be applied to the element

id

the ID of the element

prefix

the prefix for the generated CSS class resulting in the form `$prefix-$hash`

build

a lambda expression for setting up the component itself. Details in TypeAheadComponent