androidx.compose.material3
TimePickerDialogSince 1.9
Composable function
A part of TimePicker. See that page for an overview and examples.
Parameters
@Composable
fun TimePickerDialog(
onDismissRequest: () -> Unit,
confirmButton: @Composable () -> Unit,
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
properties: DialogProperties = DialogProperties(usePlatformDefaultWidth = false),
modeToggleButton: @Composable (() -> Unit)? = null,
dismissButton: @Composable (() -> Unit)? = null,
shape: Shape = TimePickerDialogDefaults.shape,
containerColor: Color = TimePickerDialogDefaults.containerColor,
content: @Composable ColumnScope.() -> Unit,
)
onDismissRequest: () -> UnitRequired
onDismissRequest: () -> UnitRequiredCalled when the user taps outside the dialog or presses back. Close the dialog here.
confirmButton: @Composable () -> UnitRequired
confirmButton: @Composable () -> UnitRequiredThe button that confirms, like "OK". Read the state and close the dialog in its onClick.
title: @Composable () -> UnitRequired
title: @Composable () -> UnitRequiredThe text at the top of the dialog, like "Select time".
properties: DialogPropertiesOptional
properties: DialogPropertiesOptionalDefault: DialogProperties(usePlatformDefaultWidth = false)
Window options of the dialog, like whether back closes it.
modeToggleButton: @Composable (() -> Unit)?Optional
modeToggleButton: @Composable (() -> Unit)?OptionalDefault: null
A button to switch between the dial and the text fields.
dismissButton: @Composable (() -> Unit)?Optional
dismissButton: @Composable (() -> Unit)?OptionalDefault: null
The button that cancels, like "Cancel".
shape: ShapeOptional
shape: ShapeOptionalDefault: TimePickerDialogDefaults.shape
Sets the outline of the dialog.
containerColor: ColorOptional
containerColor: ColorOptionalDefault: TimePickerDialogDefaults.containerColor
The background color of the dialog.
content: @Composable ColumnScope.() -> UnitRequired
content: @Composable ColumnScope.() -> UnitRequiredThe picker inside the dialog. A TimePicker or TimeInput.
Same as in TimePicker: modifier.
Types and parts
TimePickerTimeInputTimePickerDialog
See also
TimePickerDefaults: default values and helper functions forTimePickerDialog.