Compose Calendar is a simple and customizable calendar component built using Jetpack Compose for Android. It provides an easy-to-use calendar view with month navigation and date selection capabilities. I encourage you to ⭐star⭐ this repository if you find it useful!
If you're using Groovy DSL,
//settings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
//app.gradle
dependencies {
implementation 'com.github.lyh990517:Compose-Calendar-Template:latest-release'
}If you're using Kotlin DSL
//settings.gradle.kts
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven(url = "https://jitpack.io")
}
}
//app.gradle.kts
dependencies {
implementation("com.github.lyh990517:Compose-Calendar-Template:latest-release")
}@Composable
fun BasicCalendar() {
val calendarState = rememberCalendarState()
// Listen to date selection
LaunchedEffect(calendarState.selectedDate) {
calendarState.selectedDate?.let { selectedDate ->
// Handle selected date
println("Selected date: $selectedDate")
}
}
Calendar(
calendarState = calendarState,
modifier = Modifier
.fillMaxWidth()
.height(300.dp)
)
}@Composable
fun CustomCalendar() {
val calendarState = rememberCalendarState(
weekInMonth = 5, // Number of weeks to display
daysInWeek = 7 // Number of days per week
)
// Create your own UI using CalendarState.value
}If you have any questions, suggestions, or issues, feel free to reach out to us. You can find our contact information on our GitHub repository.
We appreciate your support and contributions to Compose Calendar!