Loaders
Loadersanimated

Pulsing avatar

An avatar circle haloed by an expanding ring while content loads.

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 = "avatar")
val scale by t.animateFloat(
    initialValue = 1f,
    targetValue = 1.6f,
    animationSpec = infiniteRepeatable(tween(1200, easing = LinearEasing)),
    label = "scale",
)
val primary = MaterialTheme.colorScheme.primary
Box(Modifier.size(48.dp), contentAlignment = Alignment.Center) {
    Box(
        Modifier
            .size(40.dp)
            .scale(scale)
            .graphicsLayer { alpha = 2f - scale }
            .border(2.dp, primary, CircleShape),
    )
    Box(
        Modifier
            .size(36.dp)
            .background(primary.copy(alpha = 0.18f), CircleShape),
        contentAlignment = Alignment.Center,
    ) {
        Icon(
            Icons.Filled.Person,
            contentDescription = "Loading user",
            tint = primary,
        )
    }
}