Cards
Cardsanimated
Stock Mini Chart
Stock card with a hand-drawn sparkline path that animates left to right.
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 StockMiniChartCard() {
val pts = listOf(0.6f, 0.4f, 0.7f, 0.5f, 0.8f, 0.65f, 0.9f)
val grow = remember { Animatable(0f) }
LaunchedEffect(Unit) { grow.animateTo(1f, tween(1100)) }
val line = MaterialTheme.colorScheme.primary
Card(
modifier = Modifier.fillMaxWidth().padding(16.dp),
shape = RoundedCornerShape(20.dp)
) {
Column(Modifier.padding(18.dp)) {
Row {
Text("AAPL", Modifier.weight(1f),
fontWeight = FontWeight.Bold)
Text("$192.30", fontWeight = FontWeight.SemiBold)
}
Spacer(Modifier.height(14.dp))
Canvas(Modifier.fillMaxWidth().height(70.dp)) {
val step = size.width / (pts.size - 1)
val path = Path()
pts.forEachIndexed { i, v ->
val x = i * step
val y = size.height * (1 - v)
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 * grow.value, seg, true)
drawPath(seg, line, style = Stroke(4f, cap = StrokeCap.Round))
}
}
}
}