Pickers
Pickers

Year grid

A scrollable grid of years with the current selection filled.

202420252026202720282029

Installation

caveui components are copy-paste Jetpack Compose built entirely on Material 3 — there's no caveui dependency to add. Make sure Material 3 is on your classpath (it ships with the Compose BOM), then copy the Usage snippet below into your project.

kotlin
// build.gradle.kts (module)
dependencies {
    implementation(platform("androidx.compose:compose-bom:2025.06.00"))
    implementation("androidx.compose.material3:material3")
}

Usage

kotlin
@Composable
fun YearGrid(selected: Int) {
    val years = (2021..2032).toList()
    LazyVerticalGrid(columns = GridCells.Fixed(3)) {
        items(years) { y ->
            Box(
                Modifier.padding(4.dp).height(40.dp).clip(CircleShape)
                    .background(if (y == selected) MaterialTheme.colorScheme.primary
                        else Color.Transparent)
                    .clickable { },
                contentAlignment = Alignment.Center,
            ) {
                Text("$y", color = if (y == selected)
                    MaterialTheme.colorScheme.onPrimary
                    else MaterialTheme.colorScheme.onSurface,
                    style = MaterialTheme.typography.bodyMedium)
            }
        }
    }
}