Icons
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 LikeHeart(liked: Boolean, onClick: () -> Unit) {
val scale by animateFloatAsState(
if (liked) 1f else 0.9f,
spring(dampingRatio = Spring.DampingRatioMediumBouncy, stiffness = 500f),
label = "like",
)
val burst by animateFloatAsState(if (liked) 1f else 0f, tween(450), label = "burst")
Box(Modifier.size(40.dp).clickable(onClick = onClick), contentAlignment = Alignment.Center) {
if (burst > 0f && burst < 1f) {
Canvas(Modifier.matchParentSize()) {
drawCircle(
color = Color(0xFFE11D48).copy(alpha = 1f - burst),
radius = size.minDimension / 2 * burst,
style = Stroke(2.dp.toPx()),
)
}
}
Icon(
if (liked) Icons.Filled.Favorite else Icons.Outlined.FavoriteBorder,
contentDescription = "Like",
tint = if (liked) Color(0xFFE11D48) else LocalContentColor.current,
modifier = Modifier.scale(scale),
)
}
}