Jenga Select Field
A field that shows a chosen value and opens a picker when tapped, instead of taking typed text. It looks like a JengaTextField; pair it with a picker such as io.github.joelkanyi.jenga.component.feedback.JengaListSheet.
Parameters
the chosen value's label, or null when nothing is chosen.
called when the field is tapped (open the picker here).
the Modifier for the whole field (label + box + support).
optional label shown above the field.
optional hint shown while value is null.
validation status; see JengaTextFieldStatus.
optional helper/error text shown below the field.
whether the field can be tapped.
optional icon at the start (inherits the icon color).
the end icon; a downward chevron by default.
the field shape; defaults to JengaTextFieldDefaults.shape.
the color set; defaults to JengaTextFieldDefaults.colors.
the value and placeholder text style.
the minimum height of the field box.
padding inside the field box.
space reserved around the box so it lines up with a JengaTextField.
Samples
var open by remember {
mutableStateOf(
value = false,
)
}
var fault by remember {
mutableStateOf<String?>(
value = null,
)
}
JengaSelectField(
value = fault,
onClick = { open = true },
label = "Fault",
placeholder = "Choose a fault",
)
if (open) {
JengaListSheet(
onDismissRequest = { open = false },
title = "Fault",
content = {
items(
items = listOf(
"Battery not charging",
"Panel damaged",
),
) { option ->
JengaRadioListItem(
headline = option,
selected = option == fault,
onClick = {
fault = option
open = false
},
)
}
},
)
}