Avatars
Avatarsanimated
Progress ring
An avatar framed by a circular arc that tracks profile completion progress.
NP
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 ProgressRingAvatar(initials: String, progress: Float) {
val accent = Color(0xFF10B981)
val track = MaterialTheme.colorScheme.surfaceVariant
val animated by animateFloatAsState(progress, tween(900), label = "ring")
Box(contentAlignment = Alignment.Center, modifier = Modifier.size(60.dp)) {
Canvas(Modifier.fillMaxSize()) {
val stroke = 5.dp.toPx()
drawArc(
color = track, startAngle = 0f, sweepAngle = 360f,
useCenter = false, style = Stroke(stroke, cap = StrokeCap.Round),
)
drawArc(
color = accent, startAngle = -90f, sweepAngle = 360f * animated,
useCenter = false, style = Stroke(stroke, cap = StrokeCap.Round),
)
}
Box(
Modifier.size(44.dp).clip(CircleShape)
.background(MaterialTheme.colorScheme.surfaceVariant),
contentAlignment = Alignment.Center,
) {
Text(initials, style = MaterialTheme.typography.titleSmall)
}
}
}