Charts
Chartsanimated

Timeline

A milestone timeline whose nodes pop along a line that draws itself in.

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 Timeline(
    milestones: List<Float> = listOf(0.1f, 0.35f, 0.6f, 0.85f),
    accent: Color = Color(0xFF0EA5E9),
    modifier: Modifier = Modifier,
) {
    val draw = remember { Animatable(0f) }
    LaunchedEffect(Unit) { draw.animateTo(1f, tween(1000, easing = EaseOutCubic)) }
    val line = MaterialTheme.colorScheme.outlineVariant
    Canvas(modifier.fillMaxWidth().height(70.dp)) {
        val y = size.height / 2
        drawLine(line, Offset(0f, y), Offset(size.width * draw.value, y), 2.dp.toPx())
        milestones.forEach { m ->
            val appear = ((draw.value - m) * 6f).coerceIn(0f, 1f)
            if (appear > 0f) {
                drawCircle(accent, 7.dp.toPx() * appear, Offset(m * size.width, y))
                drawCircle(Color.White, 3.dp.toPx() * appear, Offset(m * size.width, y))
            }
        }
    }
}