DatePicker

fun DatePicker(modifier: Modifier = Modifier, pickerModifier: Modifier = Modifier, state: DatePickerState = rememberDatePickerState(), onSelectedDateChange: (LocalDate) -> Unit = {}, enabled: Boolean = true, items: DatePickerItems = PickerDefaults.datePickerItems(), format: DatePickerFormat = PickerDefaults.datePickerFormat(), style: PickerStyle = PickerDefaults.style(), selectionIndicator: PickerSelectionIndicator = PickerDefaults.selectionIndicator(style), layout: DatePickerLayout = PickerDefaults.datePickerLayout(), spacingBetweenPickers: Dp = PickerDefaults.SpacingBetweenPickers, semantics: DatePickerSemantics = PickerDefaults.datePickerSemantics())

A date picker component that allows selecting year, month, and day.

Parameters

modifier

The modifier to be applied to the component.

pickerModifier

The modifier to be applied to each picker.

state

The state object to control the picker.

onSelectedDateChange

Called once after a user interaction settles on a new column value, dependent month/day values are repaired, and the final selectable date is committed to state. If an upstream settle replaces a still-moving dependent column source, that invalidated child interaction is cancelled without a callback. Programmatic DatePickerState.selectDate calls update state directly and do not invoke this callback. When app code changes the picker from a button, preset, or external value, update any app-owned state in the same handler.

enabled

Whether user scroll, click, and semantics selection actions are enabled.

items

Selectable year, month, and day item lists for the picker.

format

Visible item text and optional accessibility value descriptions for each picker column.

style

Visual and layout styling for each picker column. Per-column divider settings do not apply here; use selectionIndicator for the shared selection band instead.

selectionIndicator

The single selection band drawn across the whole picker. Defaults to a band derived from style.

layout

Column layout weights and visual order for each picker column.

spacingBetweenPickers

The spacing between the pickers.

semantics

Accessibility labels and custom action labels for each picker column.

Throws

if custom item lists are empty, contain duplicates, contain values outside the supported ranges, or omit the current selected year/month/day after date constraints are applied.