Cards
Cardsanimated

Reaction Bar

Post card with a reaction bar whose tapped icon scales and counts up.

Weekend build complete 🛠

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 ReactionBarCard() {
    var picked by remember { mutableStateOf(-1) }
    val icons = listOf(
        Icons.Default.ThumbUp,
        Icons.Default.Favorite,
        Icons.Default.Star
    )
    Card(
        modifier = Modifier.width(280.dp),
        shape = RoundedCornerShape(18.dp)
    ) {
        Column(Modifier.padding(16.dp)) {
            Text(
                "Weekend build complete 🛠",
                style = MaterialTheme.typography.bodyMedium
            )
            Spacer(Modifier.height(12.dp))
            Row(
                horizontalArrangement =
                    Arrangement.spacedBy(20.dp)
            ) {
                icons.forEachIndexed { i, ic ->
                    val s by animateFloatAsState(
                        if (picked == i) 1.3f else 1f,
                        spring(Spring.DampingRatioMediumBouncy),
                        label = "r$i"
                    )
                    IconButton(onClick = { picked = i }) {
                        Icon(
                            ic,
                            contentDescription = null,
                            modifier = Modifier.scale(s),
                            tint = if (picked == i)
                                MaterialTheme.colorScheme.primary
                            else MaterialTheme.colorScheme
                                .onSurfaceVariant
                        )
                    }
                }
            }
        }
    }
}