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 WeightTrendCard() {
val pts = listOf(72f, 71.5f, 71.8f, 71f, 70.6f,
70.2f, 69.8f)
OutlinedCard(Modifier.fillMaxWidth()) {
Column(Modifier.padding(20.dp)) {
Row(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.Bottom
) {
Text(
"69.8 kg",
style = MaterialTheme.typography.headlineSmall
)
Text(
"-2.2 kg",
color = Color(0xFF34C759),
style = MaterialTheme.typography.labelLarge
)
}
Spacer(Modifier.height(14.dp))
Canvas(Modifier.fillMaxWidth().height(70.dp)) {
val w = size.width; val h = size.height
val mn = pts.min(); val mx = pts.max()
val path = Path()
pts.forEachIndexed { i, v ->
val x = w * i / (pts.size - 1)
val y = h - (v - mn) / (mx - mn) * h
if (i == 0) path.moveTo(x, y)
else path.lineTo(x, y)
}
drawPath(
path, Color(0xFF5E5CE6),
style = Stroke(3f, cap = StrokeCap.Round)
)
}
}
}
}