Pickers
Pickers

Color picker

A swatch grid that rings the active color and echoes its hex value.

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 ColorPicker() {
    val swatches = listOf(
        Color(0xFFEF4444), Color(0xFFF97316), Color(0xFFF59E0B),
        Color(0xFF22C55E), Color(0xFF06B6D4), Color(0xFF3B82F6),
        Color(0xFF8B5CF6), Color(0xFFEC4899),
    )
    var selected by remember { mutableStateOf(5) }
    FlowRow(horizontalArrangement = Arrangement.spacedBy(10.dp),
        verticalArrangement = Arrangement.spacedBy(10.dp)) {
        swatches.forEachIndexed { i, c ->
            Box(
                Modifier.size(32.dp)
                    .border(if (i == selected) 2.dp else 0.dp, c, CircleShape)
                    .padding(4.dp).clip(CircleShape).background(c)
                    .clickable { selected = i },
            )
        }
    }
}