select Field
This function generates a selectField element. So this supports the use case to choose one item from a list of options. If there is enough vertical or horizontal space consider a radioGroup as alternative. If there are lots of option, consider using a typeAhead instead.
You have to pass a store as value in order to handle the selected value, and the events will be connected automatically.
Basic usage:
val myOptions = listOf("black", "red", "yellow")
val selectedItem = storeOf(myOptions[0]) // preselect "red"
selectField (items = myOptions, value = selectedItem) {
}See also
Parameters
a lambda expression for declaring the styling as fritz2's styling DSL
a list of all available options
for backing up the preselected item and reflecting the selection automatically.
optional CSS class that should be applied to the element
the ID of the element
the prefix for the generated CSS class resulting in the form $prefix-$hash
a lambda expression for setting up the component itself. Details in SelectFieldComponent