androidx.compose.material3

DatePickerDialog

Composable function

A part of DatePicker. See that page for an overview and examples.

Parameters

@Composable
fun DatePickerDialog(
    onDismissRequest: () -> Unit,
    confirmButton: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    dismissButton: @Composable (() -> Unit)? = null,
    shape: Shape = DatePickerDefaults.shape,
    tonalElevation: Dp = DatePickerDefaults.TonalElevation,
    colors: DatePickerColors = DatePickerDefaults.colors(),
    properties: DialogProperties = DialogProperties(usePlatformDefaultWidth = false),
    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.

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

Default: null

The button that cancels, like "Cancel".

shape: ShapeOptional

Default: DatePickerDefaults.shape

Sets the outline of the dialog.

tonalElevation: DpOptional

Default: DatePickerDefaults.TonalElevation

Tints the dialog background a little toward the primary color.

properties: DialogPropertiesOptional

Default: DialogProperties(usePlatformDefaultWidth = false)

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

content: @Composable ColumnScope.() -> UnitRequired

The picker inside the dialog. Usually a DatePicker.

Same as in DatePicker: modifier, colors.

Types and parts

See also