Composable Component

DatePickerDialog

A dialog for displaying a DatePicker.

A dialog for displaying a DatePicker. Date pickers let people select a date.

DatePickerDialog

Common
@Composable
expect 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,
)

Parameters

onDismissRequest called 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.
confirmButton button 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.
modifier the Modifier to be applied to this dialog's content.
dismissButton button 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.
shape defines the dialog's surface shape as well its shadow
tonalElevation when DatePickerColors.containerColor is ColorScheme.surface, a higher the elevation will result in a darker color in light theme and lighter color in dark theme
colors DatePickerColors that will be used to resolve the colors used for this date picker in different states. See DatePickerDefaults.colors.
properties typically platform specific properties to further configure the dialog
content the content of the dialog (i.e. a DatePicker, for example)

DatePickerDialog

Android
@Composable
actual fun DatePickerDialog(
    onDismissRequest: () -> Unit,
    confirmButton: @Composable () -> Unit,
    modifier: Modifier,
    dismissButton: @Composable (() -> Unit)?,
    shape: Shape,
    tonalElevation: Dp,
    colors: DatePickerColors,
    properties: DialogProperties,
    content: @Composable ColumnScope.() -> Unit,
)

Parameters

onDismissRequest called 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.
confirmButton button 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.
modifier the Modifier to be applied to this dialog's content.
dismissButton button 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.
shape defines the dialog's surface shape as well its shadow
tonalElevation when DatePickerColors.containerColor is ColorScheme.surface, a higher the elevation will result in a darker color in light theme and lighter color in dark theme
colors DatePickerColors that will be used to resolve the colors used for this date picker in different states. See DatePickerDefaults.colors.
properties typically platform specific properties to further configure the dialog
content the content of the dialog (i.e. a DatePicker, for example)