androidx.compose.material3
TimePicker
Composable function
A time picker picks an hour and a minute. TimePicker shows a clock dial. TimeInput shows two text fields, which is better with a keyboard.
The picker keeps its choice in a state. Create it with rememberTimePickerState(), and read state.hour and state.minute.

val state = rememberTimePickerState(initialHour = 9, initialMinute = 30, is24Hour = false)
TimePicker(state = state, layoutType = TimePickerLayoutType.Vertical)
// Read the choice with state.hour and state.minute

val state = rememberTimePickerState(initialHour = 18, initialMinute = 45, is24Hour = true)
TimeInput(state = state)
To show the picker in a dialog, put it inside a TimePickerDialog.
Basic
Uses the default shapes.
@Composable
fun TimePicker(
state: TimePickerState,
modifier: Modifier = Modifier,
colors: TimePickerColors = TimePickerDefaults.colors(),
layoutType: TimePickerLayoutType = TimePickerDefaults.layoutType(),
)
state: TimePickerStateRequired
state: TimePickerStateRequiredHolds the hour, the minute, and whether the clock uses 24 hours.
Create it with rememberTimePickerState(initialHour = 9, initialMinute = 30). is24Hour follows the system setting by default.
modifier: ModifierOptional
modifier: ModifierOptionalDefault: Modifier
Changes size, padding, or position. See the Modifier guide.
colors: TimePickerColorsOptional
colors: TimePickerColorsOptionalDefault: TimePickerDefaults.colors()
Sets all colors of the picker. Make one with TimePickerDefaults.colors.
layoutType: TimePickerLayoutTypeOptional
layoutType: TimePickerLayoutTypeOptionalDefault: TimePickerDefaults.layoutType()
Puts the dial below the time (Vertical) or beside it (Horizontal). Default: depends on the screen shape.
ExpressiveSince 1.12
Takes shapes for the time boxes and AM/PM buttons.
@Composable
fun TimePicker(
state: TimePickerState,
shapes: TimePickerShapes,
modifier: Modifier = Modifier,
colors: TimePickerColors = TimePickerDefaults.richColors(),
layoutType: TimePickerLayoutType = TimePickerDefaults.layoutType(),
)
shapes: TimePickerShapesRequired
shapes: TimePickerShapesRequiredSets the shapes of the time boxes and the AM/PM buttons.
Same as above: state, modifier, colors, layoutType.
Types and parts
TimePickerTimeInputTimePickerDialog
See also
TimePickerDefaults: default values and helper functions forTimePicker.