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
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.
dismissButton: @Composable (() -> Unit)?Optional
dismissButton: @Composable (() -> Unit)?OptionalDefault: null
The button that cancels, like "Cancel".
shape: ShapeOptional
shape: ShapeOptionalDefault: DatePickerDefaults.shape
Sets the outline of the dialog.
tonalElevation: DpOptional
tonalElevation: DpOptionalDefault: DatePickerDefaults.TonalElevation
Tints the dialog background a little toward the primary color.
properties: DialogPropertiesOptional
properties: DialogPropertiesOptionalDefault: DialogProperties(usePlatformDefaultWidth = false)
Window options of the dialog, like whether back closes it.
content: @Composable ColumnScope.() -> UnitRequired
content: @Composable ColumnScope.() -> UnitRequiredThe picker inside the dialog. Usually a DatePicker.
Same as in DatePicker: modifier, colors.
Types and parts
DatePickerDateRangePickerDatePickerDialog
See also
DatePickerDefaults: default values and helper functions forDatePickerDialog.