Icons
Iconsanimated

Timer

A countdown timer whose ring empties as the remaining time runs down to zero.

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 CountdownTimer(remaining: Float) { // 1f -> 0f
    val color = MaterialTheme.colorScheme.primary
    Canvas(Modifier.size(40.dp)) {
        val s = Stroke(4.dp.toPx(), cap = StrokeCap.Round)
        drawCircle(color.copy(alpha = 0.2f), style = s)
        drawArc(color, -90f, 360f * remaining, false, style = s)
    }
}