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 GrowthChartCard() {
val pts = listOf(0.2f, 0.35f, 0.3f, 0.5f, 0.6f, 0.75f, 0.95f)
val draw = remember { Animatable(0f) }
LaunchedEffect(Unit) {
draw.animateTo(1f, tween(1200, easing = FastOutSlowInEasing))
}
Card(
shape = RoundedCornerShape(20.dp),
modifier = Modifier.width(260.dp),
) {
Column(Modifier.padding(18.dp)) {
Row(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Column {
Text(
text = "MRR Growth",
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Text(
text = "+38%",
style = MaterialTheme.typography.headlineSmall,
fontWeight = FontWeight.Bold,
color = Color(0xFF10B981),
)
}
}
Spacer(Modifier.height(12.dp))
Canvas(
Modifier
.fillMaxWidth()
.height(56.dp),
) {
val step = size.width / (pts.size - 1)
val path = Path()
pts.forEachIndexed { i, p ->
val x = i * step
val y = size.height * (1f - p)
if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
}
val m = PathMeasure().apply { setPath(path, false) }
val seg = Path()
m.getSegment(0f, m.length * draw.value, seg, true)
drawPath(
path = seg,
color = Color(0xFF10B981),
style = Stroke(3.dp.toPx(), cap = StrokeCap.Round),
)
if (draw.value > 0.98f) {
drawCircle(
color = Color(0xFF10B981),
radius = 5.dp.toPx(),
center = Offset(
size.width,
size.height * (1f - pts.last()),
),
)
}
}
}
}
}