Build apps faster with our new App builder! Check it out →

TimePickerDialog

Common

Component in Material 3 Compose

A dialog for displaying a [TimePicker]. Time pickers let people select a time.

Last updated:

Installation

dependencies {
   implementation("androidx.compose.material3:material3:1.4.0-alpha10")
}

Overloads

@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
)

Parameters

namedescription
onDismissRequestcalled when the user tries to dismiss the Dialog by clicking outside or pressing the back button. This is not called when the dismiss button is clicked.
confirmButtonbutton which is meant to confirm a proposed action, thus resolving what triggered the dialog. The dialog does not set up any events for this button, nor does it control its enablement, so those need to be set up by the caller.
titleThe title to be displayed on top of the dialog.
modifierthe [Modifier] to be applied to this dialog's content.
propertiestypically platform specific properties to further configure the dialog
modeToggleButtonOptional toggle to switch between clock and text input modes.
dismissButtonbutton which is meant to dismiss the dialog. The dialog does not set up any events for this button so they need to be set up by the caller.
shapedefines the dialog's surface shape as well its shadow
containerColorthe color of the dialog's container
contentthe content of the dialog (i.e. a [TimePicker], for example)
by @alexstyl