androidx.compose.material3
DatePicker
Composable function
A date picker shows a calendar to pick a date. The user can also switch to typing the date.
The picker keeps its choice in a state. Create it with rememberDatePickerState(), and read state.selectedDateMillis.
Dates are milliseconds since 1 January 1970, in UTC. Convert them with kotlinx-datetime or java.time.

// Dates are milliseconds since 1970 (UTC). This is 12 May 2026.
val state = rememberDatePickerState(initialSelectedDateMillis = 1_778_544_000_000L)
DatePicker(state = state, modifier = Modifier.width(360.dp))
// Read the choice with state.selectedDateMillis
DateRangePicker picks a start and an end date. Read selectedStartDateMillis and selectedEndDateMillis from its state.

val state = rememberDateRangePickerState(
initialSelectedStartDateMillis = 1_778_544_000_000L,
initialSelectedEndDateMillis = 1_778_803_200_000L,
)
DateRangePicker(state = state, modifier = Modifier.size(360.dp, 520.dp))
To show the picker in a dialog, put it inside a DatePickerDialog, with OK and Cancel buttons.
Parameters
@Composable
fun DatePicker(
state: DatePickerState,
modifier: Modifier = Modifier,
dateFormatter: DatePickerFormatter = remember { DatePickerDefaults.dateFormatter() },
colors: DatePickerColors = DatePickerDefaults.colors(),
title: (@Composable () -> Unit)? = { DatePickerDefaults.DatePickerTitle(displayMode = state.displayMode, modifier = Modifier.padding(DatePickerTitlePadding), contentColor = colors.titleContentColor) },
headline: (@Composable () -> Unit)? = { DatePickerDefaults.DatePickerHeadline(selectedDateMillis = state.selectedDateMillis, displayMode = state.displayMode, dateFormatter = dateFormatter, modifier = Modifier.padding(DatePickerHeadlinePadding), contentColor = colors.headlineContentColor) },
showModeToggle: Boolean = true,
focusRequester: FocusRequester? = remember { FocusRequester() },
)
state: DatePickerStateRequired
state: DatePickerStateRequiredHolds the selected date, the shown month, the year range and which dates can be picked.
Create it with rememberDatePickerState(initialSelectedDateMillis = ...) or rememberDateRangePickerState(...).
To block some dates, pass selectableDates to it.
modifier: ModifierOptional
modifier: ModifierOptionalDefault: Modifier
Changes size, padding, or position. See the Modifier guide.
dateFormatter: DatePickerFormatterOptional
dateFormatter: DatePickerFormatterOptionalDefault: remember { DatePickerDefaults.dateFormatter() }
How dates and months are written in the headline and year list.
colors: DatePickerColorsOptional
colors: DatePickerColorsOptionalDefault: DatePickerDefaults.colors()
Sets all colors of the picker. Make one with DatePickerDefaults.colors.
title: (@Composable () -> Unit)?Optional
title: (@Composable () -> Unit)?OptionalDefault: { DatePickerDefaults.DatePickerTitle(displayMode = state.displayMode, modifier = Modifier.padding(DatePickerTitlePadding), contentColor = colors.titleContentColor) }
The small text at the top, like "Select date". Pass null to hide it.
headline: (@Composable () -> Unit)?Optional
headline: (@Composable () -> Unit)?OptionalDefault: { DatePickerDefaults.DatePickerHeadline(selectedDateMillis = state.selectedDateMillis, displayMode = state.displayMode, dateFormatter = dateFormatter, modifier = Modifier.padding(DatePickerHeadlinePadding), contentColor = colors.headlineContentColor) }
The large text showing the chosen date. Pass null to hide it.
showModeToggle: BooleanOptional
showModeToggle: BooleanOptionalDefault: true
Set to false to hide the pencil button that switches to typing the date.
focusRequester: FocusRequester?OptionalSince 1.9
focusRequester: FocusRequester?OptionalSince 1.9Default: remember { FocusRequester() }
Moves keyboard focus to the picker when it opens.
Types and parts
DatePickerDateRangePickerDatePickerDialog
See also
DatePickerDefaults: default values and helper functions forDatePicker.