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 FlightRouteCard() {
val draw = remember { Animatable(0f) }
LaunchedEffect(Unit) {
draw.animateTo(1f, tween(1400, easing = FastOutSlowInEasing))
}
ElevatedCard(
modifier = Modifier.fillMaxWidth().padding(16.dp)
) {
Column(Modifier.padding(20.dp)) {
Row(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
Text("SFO", style = MaterialTheme.typography.titleLarge)
Text("NRT", style = MaterialTheme.typography.titleLarge)
}
Spacer(Modifier.height(12.dp))
Canvas(Modifier.fillMaxWidth().height(48.dp)) {
val y = size.height / 2
val path = Path().apply {
moveTo(0f, y)
quadraticBezierTo(
size.width / 2, 0f, size.width, y
)
}
val m = PathMeasure().apply { setPath(path, false) }
val seg = Path()
m.getSegment(0f, m.length * draw.value, seg, true)
drawPath(
seg, Color(0xFF6366F1), style = Stroke(
3f, pathEffect = PathEffect.dashPathEffect(
floatArrayOf(12f, 10f)
)
)
)
drawCircle(Color(0xFF6366F1), 6f, Offset(0f, y))
drawCircle(Color(0xFF6366F1), 6f, Offset(size.width, y))
}
Spacer(Modifier.height(8.dp))
Text(
"11h 25m · Nonstop",
style = MaterialTheme.typography.bodySmall
)
}
}
}