DatePickerDefaults


Contains default values used by the DatePicker.

Summary

Constants

const String

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

Cmn
const String

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

Cmn
const 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")

Cmn

Public functions

Unit
@Composable
DatePickerHeadline(
    selectedDateMillis: Long?,
    displayMode: DisplayMode,
    dateFormatter: DatePickerFormatter,
    modifier: Modifier
)

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.

Cmn
Unit
@Composable
DatePickerTitle(displayMode: DisplayMode, modifier: Modifier)

A default date picker title composable.

Cmn
DatePickerColors

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

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

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

Cmn
DatePickerFormatter
dateFormatter(
    yearSelectionSkeleton: String,
    selectedDateSkeleton: String,
    selectedDateDescriptionSkeleton: String
)

Returns a DatePickerFormatter.

Cmn

Public properties

SelectableDates

A default SelectableDates that allows all dates to be selected.

Cmn
Dp

The default tonal elevation used for DatePickerDialog.

Cmn
IntRange

The range of years for the date picker dialogs.

Cmn
Shape

The default shape for date picker dialogs.

Cmn

Constants

YearAbbrMonthDaySkeleton

const val YearAbbrMonthDaySkeletonString

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

YearMonthSkeleton

const val YearMonthSkeletonString

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

YearMonthWeekdayDaySkeleton

const val YearMonthWeekdayDaySkeletonString

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")

Public functions

DatePickerHeadline

@Composable
fun DatePickerHeadline(
    selectedDateMillis: Long?,
    displayMode: DisplayMode,
    dateFormatter: DatePickerFormatter,
    modifier: Modifier = Modifier
): Unit

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.

Parameters
selectedDateMillis: Long?

a timestamp that represents the selected date start of the day in UTC milliseconds from the epoch

displayMode: DisplayMode

the current DisplayMode

dateFormatter: DatePickerFormatter

a DatePickerFormatter

modifier: Modifier = Modifier

a Modifier to be applied for the headline

DatePickerTitle

@Composable
fun DatePickerTitle(displayMode: DisplayMode, modifier: Modifier = Modifier): Unit

A default date picker title composable.

Parameters
displayMode: DisplayMode

the current DisplayMode

modifier: Modifier = Modifier

a Modifier to be applied for the title

colors

@Composable
fun colors(): DatePickerColors

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

colors

@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.

Parameters
containerColor: Color = Color.Unspecified

the color used for the date picker's background

titleContentColor: Color = Color.Unspecified

the color used for the date picker's title

headlineContentColor: Color = Color.Unspecified

the color used for the date picker's headline

weekdayContentColor: Color = Color.Unspecified

the color used for the weekday letters

subheadContentColor: Color = Color.Unspecified

the color used for the month and year subhead labels that appear when months are displayed at a DateRangePicker.

navigationContentColor: Color = Color.Unspecified

the content color used for the year selection menu button and the months arrow navigation when displayed at a DatePicker.

yearContentColor: Color = Color.Unspecified

the color used for a year item content

disabledYearContentColor: Color = Color.Unspecified

the color used for a disabled year item content

currentYearContentColor: Color = Color.Unspecified

the color used for the current year content when selecting a year

selectedYearContentColor: Color = Color.Unspecified

the color used for a selected year item content

disabledSelectedYearContentColor: Color = Color.Unspecified

the color used for a disabled selected year item content

selectedYearContainerColor: Color = Color.Unspecified

the color used for a selected year item container

disabledSelectedYearContainerColor: Color = Color.Unspecified

the color used for a disabled selected year item container

dayContentColor: Color = Color.Unspecified

the color used for days content

disabledDayContentColor: Color = Color.Unspecified

the color used for disabled days content

selectedDayContentColor: Color = Color.Unspecified

the color used for selected days content

disabledSelectedDayContentColor: Color = Color.Unspecified

the color used for disabled selected days content

selectedDayContainerColor: Color = Color.Unspecified

the color used for a selected day container

disabledSelectedDayContainerColor: Color = Color.Unspecified

the color used for a disabled selected day container

todayContentColor: Color = Color.Unspecified

the color used for the day that marks the current date

todayDateBorderColor: Color = Color.Unspecified

the color used for the border of the day that marks the current date

dayInSelectionRangeContentColor: Color = Color.Unspecified

the content color used for days that are within a date range selection

dayInSelectionRangeContainerColor: Color = Color.Unspecified

the container color used for days that are within a date range selection

dividerColor: Color = Color.Unspecified

the color used for the dividers used at the date pickers

dateTextFieldColors: TextFieldColors? = null

the TextFieldColors defaults for the date text field when in DisplayMode.Input. See OutlinedTextFieldDefaults.colors.

dateFormatter

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

Returns a DatePickerFormatter.

The date formatter will apply the best possible localized form of the given skeleton and Locale. A skeleton is similar to, and uses the same format characters as, a Unicode UTS #35 pattern.

One difference is that order is irrelevant. For example, "MMMMd" will return "MMMM d" in the en_US locale, but "d. MMMM" in the de_CH locale.

Parameters
yearSelectionSkeleton: String = YearMonthSkeleton

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

selectedDateSkeleton: String = YearAbbrMonthDaySkeleton

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

selectedDateDescriptionSkeleton: String = YearMonthWeekdayDaySkeleton

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")

Public properties

AllDates

val AllDatesSelectableDates

A default SelectableDates that allows all dates to be selected.

TonalElevation

val TonalElevationDp

The default tonal elevation used for DatePickerDialog.

YearRange

val YearRangeIntRange

The range of years for the date picker dialogs.

shape

val shapeShape

The default shape for date picker dialogs.