PickerDefaults

Contains default values and factory methods for creating Picker styles. Follows Material3 component design patterns.

Properties

Link copied to clipboard

Default shape for the dividers.

Link copied to clipboard

Default thickness of the dividers.

Link copied to clipboard

Default width of the selection dividers. Defaults to filling the picker column width.

Link copied to clipboard

Default padding around each item.

Link copied to clipboard

Default semantics action label for selecting the next picker item.

Link copied to clipboard

Default semantics action label for selecting the previous picker item.

Link copied to clipboard

Default shape for the selected item background.

Link copied to clipboard

Default horizontal inset applied to each side of a composite picker's selection indicator band.

Link copied to clipboard

Default spacing between pickers in composite components (e.g., TimePicker, DatePicker).

Link copied to clipboard
const val VisibleItemsCount: Int = 3

Default number of visible items in the picker. Must be an odd number for proper center alignment.

Functions

Link copied to clipboard
fun colors(dividerColor: Color = LocalContentColor.current.copy(alpha = 0.2f), selectedItemBackgroundColor: Color = Color.Transparent, textColor: Color = LocalContentColor.current.copy(alpha = 0.7f), selectedTextColor: Color = LocalContentColor.current, disabledDividerColor: Color = dividerColor.copy(alpha = dividerColor.alpha * DISABLED_CONTAINER_ALPHA), disabledSelectedItemBackgroundColor: Color = selectedItemBackgroundColor.copy( alpha = selectedItemBackgroundColor.alpha * DISABLED_CONTAINER_ALPHA ), disabledTextColor: Color = textColor.copy(alpha = textColor.alpha * DISABLED_CONTENT_ALPHA), disabledSelectedTextColor: Color = selectedTextColor.copy( alpha = selectedTextColor.alpha * DISABLED_CONTENT_ALPHA )): PickerColors

Creates a PickerColors with the provided colors.

Link copied to clipboard
fun datePickerConstraints(minDate: LocalDate? = null, maxDate: LocalDate? = null): DatePickerConstraints

Creates inclusive date constraints for a date picker.

Link copied to clipboard
fun datePickerFormat(yearItemText: (Int) -> String = DefaultIntegerItemText, monthItemText: (Int) -> String = DefaultIntegerItemText, dayItemText: (Int) -> String = DefaultIntegerItemText, yearItemContentDescription: (Int) -> String? = null, monthItemContentDescription: (Int) -> String? = null, dayItemContentDescription: (Int) -> String? = null): DatePickerFormat

Creates value formatting for a date picker.

Link copied to clipboard
fun datePickerItems(yearItems: List<Int> = YEAR_RANGE, monthItems: List<Int> = MONTH_RANGE, dayItems: List<Int> = DAY_RANGE, minDate: LocalDate? = null, maxDate: LocalDate? = null): DatePickerItems

Creates selectable item lists for a date picker.

Link copied to clipboard
fun datePickerLayout(yearWeight: Float? = 1.2f, monthWeight: Float? = 0.8f, dayWeight: Float? = 0.8f, columnOrder: List<DatePickerColumn> = listOf( DatePickerColumn.YEAR, DatePickerColumn.MONTH, DatePickerColumn.DAY )): DatePickerLayout

Creates layout options for io.github.kezlab.compose.pickers.date.DatePicker columns.

Link copied to clipboard
fun datePickerSemantics(yearPickerLabel: String? = "Year", monthPickerLabel: String? = "Month", dayPickerLabel: String? = "Day", previousItemActionLabel: String? = PreviousItemActionLabel, nextItemActionLabel: String? = NextItemActionLabel): DatePickerSemantics

Creates semantics configuration for a date picker.

Link copied to clipboard
fun dateRangePickerSemantics(start: DatePickerSemantics = datePickerSemantics( yearPickerLabel = "Start year", monthPickerLabel = "Start month", dayPickerLabel = "Start day" ), end: DatePickerSemantics = datePickerSemantics( yearPickerLabel = "End year", monthPickerLabel = "End month", dayPickerLabel = "End day" )): DateRangePickerSemantics

Creates semantics configuration for a date range picker.

Link copied to clipboard
fun durationPickerConstraints(minDuration: Duration? = null, maxDuration: Duration? = null): DurationPickerConstraints

Creates inclusive whole-minute scalar constraints for a duration picker.

Link copied to clipboard
fun durationPickerFormat(hourItemText: (Int) -> String = DefaultIntegerItemText, minuteItemText: (Int) -> String = DefaultIntegerItemText, hourItemContentDescription: (Int) -> String? = null, minuteItemContentDescription: (Int) -> String? = null): DurationPickerFormat

Creates value formatting for a duration picker.

Link copied to clipboard
fun durationPickerItems(hourItems: List<Int> = DEFAULT_DURATION_HOUR_ITEMS, minuteItems: List<Int> = MINUTE_RANGE, minDuration: Duration? = null, maxDuration: Duration? = null): DurationPickerItems

Creates selectable item sources for a duration picker.

Link copied to clipboard
fun durationPickerLayout(hourWeight: Float? = 1.0f, minuteWeight: Float? = 1.0f, columnOrder: List<DurationPickerColumn> = listOf( DurationPickerColumn.HOUR, DurationPickerColumn.MINUTE )): DurationPickerLayout
Link copied to clipboard
fun durationPickerSemantics(hourPickerLabel: String? = "Hours", minutePickerLabel: String? = "Minutes", previousItemActionLabel: String? = PreviousItemActionLabel, nextItemActionLabel: String? = NextItemActionLabel): DurationPickerSemantics

Creates accessibility configuration for a duration picker.

Link copied to clipboard

Creates the default fading edge gradient.

Link copied to clipboard
fun <T : Any> itemFormat(itemText: (T) -> String = { it.toString() }, itemContentDescription: (T) -> String? = null): PickerItemFormat<T>

Creates value formatting for one picker column.

Link copied to clipboard
fun selectionIndicator(color: Color = LocalContentColor.current.copy(alpha = 0.2f), thickness: Dp = DividerThickness, shape: Shape = DividerShape, horizontalInset: Dp = SelectionIndicatorHorizontalInset, isVisible: Boolean = true, disabledColor: Color = color.copy(alpha = color.alpha * DISABLED_CONTAINER_ALPHA)): PickerSelectionIndicator

Creates a PickerSelectionIndicator without requiring a PickerStyle.

fun selectionIndicator(style: PickerStyle, color: Color = style.colors.dividerColor, thickness: Dp = style.dividerThickness, shape: Shape = style.dividerShape, horizontalInset: Dp = SelectionIndicatorHorizontalInset, isVisible: Boolean = style.isDividerVisible, disabledColor: Color = style.colors.disabledDividerColor): PickerSelectionIndicator
Link copied to clipboard
fun semantics(pickerLabel: String? = null, previousItemActionLabel: String? = PreviousItemActionLabel, nextItemActionLabel: String? = NextItemActionLabel): PickerSemantics

Creates semantics configuration for one picker column.

Link copied to clipboard
fun style(visibleItemsCount: Int = VisibleItemsCount, colors: PickerColors = PickerDefaults.colors(), textStyles: PickerTextStyles = PickerDefaults.textStyles(), selectedItemBackgroundShape: Shape = SelectedItemBackgroundShape, itemPadding: PaddingValues = ItemPadding, fadingEdgeGradient: Brush = fadingEdgeGradient(), horizontalAlignment: Alignment.Horizontal = Alignment.CenterHorizontally, dividerThickness: Dp = DividerThickness, dividerShape: Shape = DividerShape, dividerWidth: PickerDividerWidth = DividerWidth, isDividerVisible: Boolean = true): PickerStyle

Creates a PickerStyle that groups picker visual and layout styling.

Link copied to clipboard
fun textStyles(textStyle: TextStyle = LocalTextStyle.current.copy(fontSize = 16.sp), selectedTextStyle: TextStyle = LocalTextStyle.current.copy(fontSize = 22.sp)): PickerTextStyles

Creates a PickerTextStyles with the provided text styles.

Link copied to clipboard
fun timePickerConstraints(minTime: LocalTime? = null, maxTime: LocalTime? = null): TimePickerConstraints

Creates inclusive time constraints for a time picker.

Link copied to clipboard
fun timePickerFormat(hourItemText: (Int) -> String = DefaultIntegerItemText, minuteItemText: (Int) -> String = DefaultIntegerItemText, periodItemText: (TimePeriod) -> String = DefaultPeriodItemText, hourItemContentDescription: (Int) -> String? = null, minuteItemContentDescription: (Int) -> String? = null, periodItemContentDescription: (TimePeriod) -> String? = null): TimePickerFormat

Creates value formatting for a time picker.

Link copied to clipboard
fun timePickerItems(minuteItems: List<Int> = MINUTE_RANGE, hour24Items: List<Int> = HOUR24_RANGE, hour12Items: List<Int> = HOUR12_RANGE, periodItems: List<TimePeriod> = TimePeriod.entries, minTime: LocalTime? = null, maxTime: LocalTime? = null): TimePickerItems

Creates selectable item lists for a time picker.

Link copied to clipboard
fun timePickerLayout(periodWeight: Float? = 1.0f, hourWeight: Float? = 1.0f, minuteWeight: Float? = 1.0f, columnOrder: List<TimePickerColumn> = listOf( TimePickerColumn.PERIOD, TimePickerColumn.HOUR, TimePickerColumn.MINUTE )): TimePickerLayout

Creates layout options for io.github.kezlab.compose.pickers.time.TimePicker columns.

Link copied to clipboard
fun timePickerSemantics(hourPickerLabel: String? = "Hour", minutePickerLabel: String? = "Minute", periodPickerLabel: String? = "AM/PM", previousItemActionLabel: String? = PreviousItemActionLabel, nextItemActionLabel: String? = NextItemActionLabel): TimePickerSemantics

Creates semantics configuration for a time picker.

Link copied to clipboard
fun yearMonthPickerConstraints(minYearMonth: YearMonth? = null, maxYearMonth: YearMonth? = null): YearMonthPickerConstraints

Creates inclusive year/month constraints for a year-month picker.

Link copied to clipboard
fun yearMonthPickerFormat(yearItemText: (Int) -> String = DefaultIntegerItemText, monthItemText: (Int) -> String = DefaultIntegerItemText, yearItemContentDescription: (Int) -> String? = null, monthItemContentDescription: (Int) -> String? = null): YearMonthPickerFormat

Creates value formatting for a year-month picker.

Link copied to clipboard
fun yearMonthPickerItems(yearItems: List<Int> = YEAR_RANGE, monthItems: List<Int> = MONTH_RANGE, minYearMonth: YearMonth? = null, maxYearMonth: YearMonth? = null): YearMonthPickerItems

Creates selectable item lists for a year-month picker.

Link copied to clipboard
fun yearMonthPickerLayout(yearWeight: Float? = 1.0f, monthWeight: Float? = 1.0f, columnOrder: List<YearMonthPickerColumn> = listOf( YearMonthPickerColumn.YEAR, YearMonthPickerColumn.MONTH )): YearMonthPickerLayout

Creates layout options for io.github.kezlab.compose.pickers.date.YearMonthPicker columns.

Link copied to clipboard
fun yearMonthPickerSemantics(yearPickerLabel: String? = "Year", monthPickerLabel: String? = "Month", previousItemActionLabel: String? = PreviousItemActionLabel, nextItemActionLabel: String? = NextItemActionLabel): YearMonthPickerSemantics

Creates semantics configuration for a year-month picker.