
Truly native date picker UI leveraging system pickers, auto-inheriting app theming; asynchronous suspend-style APIs for single or range selection, plus UI toolkit helper.
A Kotlin Multiplatform library that provides a truly native Date Picker experience for both Android and iOS. This library uses platform-specific components that automatically inherit your application's theme and branding.
MaterialDatePicker on Android and Apple's UIDatePicker on iOS.suspend functions that return selected timestamps (Long) or date ranges.rememberDatePicker() helper for seamless integration.| Android | iOS |
|---|---|
![]() |
![]() |
Add the dependency to your commonMain source set in your build.gradle.kts:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.ktsnippetbyshubham:kmp-native-datepicker:1.0.1")
}
}
}Use the rememberDatePicker() helper to get an instance of the picker in your UI.
val datePicker = rememberDatePicker()
val scope = rememberCoroutineScope()
Button(onClick = {
scope.launch {
val selectedMillis = datePicker.pickDate(
title = "Select Birthday",
doneButtonText = "Save",
cancelButtonText = "Close"
)
// returns Long? (null if cancelled)
}
}) {
Text("Open Picker")
}Button(onClick = {
scope.launch {
val range = datePicker.pickDateRange(
title = "Select Vacation Dates"
)
// returns DateRange? { startDateMillis, endDateMillis }
}
}) {
Text("Open Range Picker")
}If you are not using Compose:
val datePicker = DatePickerFactory(context).createDatePicker()
val datePicker = DatePickerFactory().createDatePicker()
The library is designed to be "Brand-Aware". You don't need to pass color codes manually.
The picker follows your MaterialTheme. To change the color, simply update your colorPrimary in your app's theme:
<item name="colorPrimary">#FF5722</item> <!-- Your brand color -->The picker automatically uses the System Global Tint. If you have set a custom tint color for your app's window, the picker buttons and selection highlights will match it automatically.
| Parameter | Type | Description |
|---|---|---|
initialDateMillis |
Long? |
Initial date to show (Default: Now) |
minDateMillis |
Long? |
Minimum selectable date |
maxDateMillis |
Long? |
Maximum selectable date |
title |
String? |
Custom title for the dialog |
doneButtonText |
String? |
Label for the positive button |
cancelButtonText |
String? |
Label for the negative button |
Similar parameters to pickDate, but returns a DateRange object containing startDateMillis and endDateMillis.
MaterialDatePicker. The range picker is specifically configured to show as a centered popup/dialog rather than full-screen for a better user experience.UIDatePicker inside a UIAlertController. Single dates use the classic Wheel style, while Range selection uses a smart sequential selection with the Inline Calendar style.Apache License 2.0. See LICENSE for details.
A Kotlin Multiplatform library that provides a truly native Date Picker experience for both Android and iOS. This library uses platform-specific components that automatically inherit your application's theme and branding.
MaterialDatePicker on Android and Apple's UIDatePicker on iOS.suspend functions that return selected timestamps (Long) or date ranges.rememberDatePicker() helper for seamless integration.| Android | iOS |
|---|---|
![]() |
![]() |
Add the dependency to your commonMain source set in your build.gradle.kts:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.ktsnippetbyshubham:kmp-native-datepicker:1.0.1")
}
}
}Use the rememberDatePicker() helper to get an instance of the picker in your UI.
val datePicker = rememberDatePicker()
val scope = rememberCoroutineScope()
Button(onClick = {
scope.launch {
val selectedMillis = datePicker.pickDate(
title = "Select Birthday",
doneButtonText = "Save",
cancelButtonText = "Close"
)
// returns Long? (null if cancelled)
}
}) {
Text("Open Picker")
}Button(onClick = {
scope.launch {
val range = datePicker.pickDateRange(
title = "Select Vacation Dates"
)
// returns DateRange? { startDateMillis, endDateMillis }
}
}) {
Text("Open Range Picker")
}If you are not using Compose:
val datePicker = DatePickerFactory(context).createDatePicker()
val datePicker = DatePickerFactory().createDatePicker()
The library is designed to be "Brand-Aware". You don't need to pass color codes manually.
The picker follows your MaterialTheme. To change the color, simply update your colorPrimary in your app's theme:
<item name="colorPrimary">#FF5722</item> <!-- Your brand color -->The picker automatically uses the System Global Tint. If you have set a custom tint color for your app's window, the picker buttons and selection highlights will match it automatically.
| Parameter | Type | Description |
|---|---|---|
initialDateMillis |
Long? |
Initial date to show (Default: Now) |
minDateMillis |
Long? |
Minimum selectable date |
maxDateMillis |
Long? |
Maximum selectable date |
title |
String? |
Custom title for the dialog |
doneButtonText |
String? |
Label for the positive button |
cancelButtonText |
String? |
Label for the negative button |
Similar parameters to pickDate, but returns a DateRange object containing startDateMillis and endDateMillis.
MaterialDatePicker. The range picker is specifically configured to show as a centered popup/dialog rather than full-screen for a better user experience.UIDatePicker inside a UIAlertController. Single dates use the classic Wheel style, while Range selection uses a smart sequential selection with the Inline Calendar style.Apache License 2.0. See LICENSE for details.