JengaTimeInput

fun JengaTimeInput(time: LocalTime, onTimeChange: (LocalTime) -> Unit, hourLabel: String, minuteLabel: String, amLabel: String, pmLabel: String, modifier: Modifier = Modifier, style: JengaTimeInputStyle = JengaTimeInputStyle.Wheel, is24Hour: Boolean = false, minuteStep: Int = 1)(source)

A time input: hour and minute, plus AM / PM in 12-hour mode, as scroll wheels or typed fields. Every visible string comes from the caller.

Parameters

time

the selected time.

onTimeChange

called with the new time.

hourLabel

the label for the hour wheel or field (e.g. "Hour").

minuteLabel

the label for the minute wheel or field (e.g. "Minute").

amLabel

the label for the morning half (e.g. "AM").

pmLabel

the label for the afternoon half (e.g. "PM").

modifier

the Modifier for the input.

style

wheels or typed fields; see JengaTimeInputStyle.

is24Hour

whether hours run 0 to 23 with no AM / PM choice.

minuteStep

the gap between minutes on the minute wheel (e.g. 5); typed fields accept any minute.

Samples

var time by remember {
    mutableStateOf(
        value = LocalTime(
            hour = 9,
            minute = 30,
        ),
    )
}
JengaTimeInput(
    time = time,
    onTimeChange = { time = it },
    hourLabel = "Hour",
    minuteLabel = "Minute",
    amLabel = "AM",
    pmLabel = "PM",
)