androidx.compose.material3

DatePickerDefaults

Object

No hand-written docs yet.

Contains default values used by the DatePicker.

object DatePickerDefaults

Properties

YearRange

val YearRange: IntRange

The range of years for the date picker dialogs.

TonalElevation

val TonalElevation: Dp

The default tonal elevation used for DatePickerDialog.

shape

@Composable val shape: Shape

The default shape for date picker dialogs.

AllDates

val AllDates: SelectableDates

A default SelectableDates that allows all dates to be selected.

YearMonthSkeleton

const val YearMonthSkeleton: String

A date format skeleton used to format the date picker's year selection menu button (e.g. "March 2021")

YearAbbrMonthDaySkeleton

const val YearAbbrMonthDaySkeleton: String

A date format skeleton used to format a selected date (e.g. "Mar 27, 2021")

YearMonthWeekdayDaySkeleton

const val YearMonthWeekdayDaySkeleton: String

A date format skeleton used to format a selected date to be used as content description for screen readers (e.g. "Saturday, March 27, 2021")

Functions

colors

@Composable
fun colors(): DatePickerColors

Creates a DatePickerColors that will potentially animate between the provided colors according to the Material specification.

@Composable
fun colors(
    containerColor: Color = Color.Unspecified,
    titleContentColor: Color = Color.Unspecified,
    headlineContentColor: Color = Color.Unspecified,
    weekdayContentColor: Color = Color.Unspecified,
    subheadContentColor: Color = Color.Unspecified,
    navigationContentColor: Color = Color.Unspecified,
    yearContentColor: Color = Color.Unspecified,
    disabledYearContentColor: Color = Color.Unspecified,
    currentYearContentColor: Color = Color.Unspecified,
    selectedYearContentColor: Color = Color.Unspecified,
    disabledSelectedYearContentColor: Color = Color.Unspecified,
    selectedYearContainerColor: Color = Color.Unspecified,
    disabledSelectedYearContainerColor: Color = Color.Unspecified,
    dayContentColor: Color = Color.Unspecified,
    disabledDayContentColor: Color = Color.Unspecified,
    selectedDayContentColor: Color = Color.Unspecified,
    disabledSelectedDayContentColor: Color = Color.Unspecified,
    selectedDayContainerColor: Color = Color.Unspecified,
    disabledSelectedDayContainerColor: Color = Color.Unspecified,
    todayContentColor: Color = Color.Unspecified,
    todayDateBorderColor: Color = Color.Unspecified,
    dayInSelectionRangeContentColor: Color = Color.Unspecified,
    dayInSelectionRangeContainerColor: Color = Color.Unspecified,
    dividerColor: Color = Color.Unspecified,
    dateTextFieldColors: TextFieldColors? = null,
): DatePickerColors

Creates a DatePickerColors that will potentially animate between the provided colors according to the Material specification.

dateFormatter

fun dateFormatter(
    yearSelectionSkeleton: String = YearMonthSkeleton,
    selectedDateSkeleton: String = YearAbbrMonthDaySkeleton,
    selectedDateDescriptionSkeleton: String = YearMonthWeekdayDaySkeleton,
): DatePickerFormatter

Returns a DatePickerFormatter.

DatePickerTitle

@Composable
fun DatePickerTitle(
    displayMode: DisplayMode,
    modifier: Modifier = Modifier,
    contentColor: Color = colors().titleContentColor,
)

A default date picker title composable.

DatePickerHeadline

@Composable
fun DatePickerHeadline(
    selectedDateMillis: Long?,
    displayMode: DisplayMode,
    dateFormatter: DatePickerFormatter,
    modifier: Modifier = Modifier,
    contentColor: Color = colors().headlineContentColor,
)

A default date picker headline composable that displays a default headline text when there is no date selection, and an actual date string when there is.

Library docs

Contains default values used by the DatePicker.