TimePicker

fun TimePicker(value: TimeValue, onValueChange: (TimeValue) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, is24Hour: Boolean = true, amPmFirst: Boolean = false, amLabel: String = TimePickerDefaults.AmLabel, pmLabel: String = TimePickerDefaults.PmLabel, hourUnit: String = TimePickerDefaults.HourUnit, minuteUnit: String = TimePickerDefaults.MinuteUnit, hourColumnWidth: Dp = TimePickerDefaults.HourColumnWidth, minuteColumnWidth: Dp = TimePickerDefaults.MinuteColumnWidth, amPmColumnWidth: Dp = TimePickerDefaults.AmPmColumnWidth, colors: NumberPickerColors = NumberPickerDefaults.colors(), textStyle: TextStyle = COUITheme.textStyles.title3, itemHeight: Dp = NumberPickerDefaults.ItemHeight, insideMargin: PaddingValues = TimePickerDefaults.InsideMargin)

A TimePicker component with COUI style.

Hour and minute scroll wheels arranged like the COUI time picker (COUITimeLimitPicker). In 12-hour mode an AM/PM wheel is added; COUI places it before the hour wheel for locales whose time pattern starts with the day period (e.g. Chinese) and after the minute wheel otherwise, which is controlled here by amPmFirst. Optional unit labels (e.g. "h" / "min") are drawn beside the selected row, matching the COUI unit text.

Parameters

value

The currently selected time. The hour is always in 24-hour form.

onValueChange

The callback invoked when the selected time changes.

modifier

The modifier to be applied to the TimePicker.

enabled

Whether the TimePicker is enabled for user interaction.

is24Hour

Whether the hour wheel uses the 24-hour format. When false, hours display as 1..12 with an AM/PM wheel.

amPmFirst

Whether the AM/PM wheel is placed before the hour wheel (only used when is24Hour is false).

amLabel

The display string for AM on the AM/PM wheel.

pmLabel

The display string for PM on the AM/PM wheel.

hourUnit

The unit label drawn beside the selected hour; empty to hide.

minuteUnit

The unit label drawn beside the selected minute; empty to hide.

hourColumnWidth

The width of the hour column.

minuteColumnWidth

The width of the minute column.

amPmColumnWidth

The width of the AM/PM column.

colors

The NumberPickerColors for the wheels.

textStyle

The TextStyle for the wheel items.

itemHeight

The height of each wheel item.

insideMargin

The padding around the wheel columns.