Badges
Badgesanimated

Countdown ring

A deadline chip whose ring drains clockwise as the time remaining ticks down.

Ends in 3d

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
val t = rememberInfiniteTransition(label = "countdown")
val left by t.animateFloat(
    initialValue = 1f,
    targetValue = 0f,
    animationSpec = infiniteRepeatable(tween(4000, easing = LinearEasing)),
    label = "left",
)
val amber = Color(0xFFD97706)
Surface(
    shape = RoundedCornerShape(50),
    color = amber.copy(alpha = 0.12f),
    contentColor = amber,
) {
    Row(
        Modifier.padding(start = 6.dp, end = 12.dp, top = 4.dp, bottom = 4.dp),
        verticalAlignment = Alignment.CenterVertically,
        horizontalArrangement = Arrangement.spacedBy(6.dp),
    ) {
        Canvas(Modifier.size(16.dp)) {
            val s = Stroke(2.5.dp.toPx(), cap = StrokeCap.Round)
            drawArc(amber.copy(alpha = 0.2f), 0f, 360f, false, style = s)
            drawArc(amber, -90f, 360f * left, false, style = s)
        }
        Text("Ends in 3d", fontSize = 12.sp, fontWeight = FontWeight.Medium)
    }
}