YearMonthPicker

fun YearMonthPicker(modifier: Modifier = Modifier, pickerModifier: Modifier = Modifier, state: YearMonthPickerState = rememberYearMonthPickerState(), onSelectedYearMonthChange: (YearMonth) -> Unit = {}, enabled: Boolean = true, items: YearMonthPickerItems = PickerDefaults.yearMonthPickerItems(), format: YearMonthPickerFormat = PickerDefaults.yearMonthPickerFormat(), style: PickerStyle = PickerDefaults.style(), selectionIndicator: PickerSelectionIndicator = PickerDefaults.selectionIndicator(style), layout: YearMonthPickerLayout = PickerDefaults.yearMonthPickerLayout(), spacingBetweenPickers: Dp = PickerDefaults.SpacingBetweenPickers, semantics: YearMonthPickerSemantics = PickerDefaults.yearMonthPickerSemantics())

A year and month picker component.

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.

onSelectedYearMonthChange

Called after user interaction changes the selected year/month. Programmatic YearMonthPickerState.selectYearMonth and YearMonthPickerState.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 and month item lists plus optional year/month bounds 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 after year/month constraints are applied.