Cards
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 StackedProgressCard() {
val segs = listOf(
Triple("Housing", 0.45f, Color(0xFF6366F1)),
Triple("Food", 0.3f, Color(0xFF10B981)),
Triple("Other", 0.15f, Color(0xFFF59E0B)),
)
val grow = remember { Animatable(0f) }
LaunchedEffect(Unit) {
grow.animateTo(1f, tween(1000, easing = FastOutSlowInEasing))
}
Card(
shape = RoundedCornerShape(18.dp),
modifier = Modifier.width(260.dp),
) {
Column(Modifier.padding(18.dp)) {
Text(text = "Budget", fontWeight = FontWeight.SemiBold)
Spacer(Modifier.height(12.dp))
Row(
Modifier
.fillMaxWidth()
.height(14.dp)
.clip(RoundedCornerShape(50)),
) {
segs.forEach { (_, frac, c) ->
Box(
Modifier
.weight(frac * grow.value + 0.0001f)
.fillMaxHeight()
.background(c),
)
}
}
Spacer(Modifier.height(12.dp))
segs.forEach { (label, frac, c) ->
Row(verticalAlignment = Alignment.CenterVertically) {
Box(
Modifier
.size(8.dp)
.clip(CircleShape)
.background(c),
)
Spacer(Modifier.width(8.dp))
Text(
text = "$label ${(frac * 100).toInt()}%",
style = MaterialTheme.typography.bodySmall,
)
}
}
}
}
}