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

Called when the user taps outside the dialog or presses back. Close the dialog here.

confirmButton: @Composable () -> UnitRequired

The button that confirms, like "OK". Read the state and close the dialog in its onClick.

title: @Composable () -> UnitRequired

The text at the top of the dialog, like "Select time".

properties: DialogPropertiesOptional

Default: DialogProperties(usePlatformDefaultWidth = false)

Window options of the dialog, like whether back closes it.

modeToggleButton: @Composable (() -> Unit)?Optional

Default: null

A button to switch between the dial and the text fields.

dismissButton: @Composable (() -> Unit)?Optional

Default: null

The button that cancels, like "Cancel".

shape: ShapeOptional

Default: TimePickerDialogDefaults.shape

Sets the outline of the dialog.

containerColor: ColorOptional

Default: TimePickerDialogDefaults.containerColor

The background color of the dialog.

content: @Composable ColumnScope.() -> UnitRequired

The picker inside the dialog. A TimePicker or TimeInput.

Same as in TimePicker: modifier.

Types and parts

See also