Badges
Badgesanimated
Star rating
A rating chip where a gold layer wipes across the stars to reveal the score.
4.9
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
var shown by remember { mutableStateOf(false) }
LaunchedEffect(Unit) { shown = true }
val fill by animateFloatAsState(
targetValue = if (shown) 0.94f else 0f,
animationSpec = tween(1000, easing = EaseOutCubic),
label = "fill",
)
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp),
) {
Box {
Row(horizontalArrangement = Arrangement.spacedBy(1.dp)) {
repeat(5) { Icon(Icons.Filled.Star, null, Modifier.size(13.dp), tint = Color(0xFFE5E7EB)) }
}
Row(
Modifier
.matchParentSize()
.clipToBounds()
.drawWithContent {
clipRect(right = size.width * fill) { this@drawWithContent.drawContent() }
},
horizontalArrangement = Arrangement.spacedBy(1.dp),
) {
repeat(5) { Icon(Icons.Filled.Star, null, Modifier.size(13.dp), tint = Color(0xFFF59E0B)) }
}
}
Text("4.9", fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
}