Selects
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 ColorSwatchSelect() {
val colors = listOf(
Color(0xFFEF4444), Color(0xFFF59E0B), Color(0xFF10B981),
Color(0xFF3B82F6), Color(0xFF8B5CF6),
)
var selected by remember { mutableStateOf(3) }
Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
colors.forEachIndexed { i, c ->
val ringWidth by animateDpAsState(
if (i == selected) 2.dp else 0.dp, label = "ring",
)
Box(
Modifier.size(32.dp)
.border(ringWidth, c, CircleShape)
.padding(4.dp)
.clip(CircleShape)
.background(c)
.clickable { selected = i },
)
}
}
}