TimePicker

fun TimePicker(modifier: Modifier = Modifier, pickerModifier: Modifier = Modifier, state: TimePickerState = rememberTimePickerState(), onSelectedTimeChange: (LocalTime) -> Unit = {}, enabled: Boolean = true, items: TimePickerItems = PickerDefaults.timePickerItems(), format: TimePickerFormat = PickerDefaults.timePickerFormat(), style: PickerStyle = PickerDefaults.style(), selectionIndicator: PickerSelectionIndicator = PickerDefaults.selectionIndicator(style), layout: TimePickerLayout = PickerDefaults.timePickerLayout(), spacingBetweenPickers: Dp = PickerDefaults.SpacingBetweenPickers, semantics: TimePickerSemantics = PickerDefaults.timePickerSemantics())

A time picker component that allows the user to select hours, minutes, and—when using the 12-hour format—the AM/PM period.

Parameters

modifier

The modifier to be applied to the component.

pickerModifier

The modifier to be applied to each picker.

state

The state object to control the picker.

onSelectedTimeChange

Called once after a user interaction settles on a new column value, dependent period/hour/minute values are repaired, and the final selectable time is committed to state. If an upstream settle replaces a still-moving dependent column source, that invalidated child interaction is cancelled without a callback. Programmatic TimePickerState.selectTime calls update state directly and do not invoke this callback. When app code changes the picker from a button, preset, or external value, update any app-owned state in the same handler.

enabled

Whether user scroll, click, and semantics selection actions are enabled.

items

Selectable minute, hour, and period item lists for the picker.

format

Visible item text and optional accessibility value descriptions for each picker column.

style

Visual and layout styling for each picker column. Per-column divider settings do not apply here; use selectionIndicator for the shared selection band instead.

selectionIndicator

The single selection band drawn across the whole picker. Defaults to a band derived from style.

layout

Column layout weights and visual order for each picker column.

spacingBetweenPickers

The spacing between the pickers.

semantics

Accessibility labels and custom action labels for each picker column.

Throws

if custom item lists are empty where required, contain duplicates, contain values outside the supported ranges, or omit the current selected value after time constraints are applied.