Badges
Badgesanimated

Presence

An avatar with an online dot that softly breathes inside a status ring.

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 = "presence")
val pulse by t.animateFloat(
    initialValue = 0.8f,
    targetValue = 1.6f,
    animationSpec = infiniteRepeatable(tween(1400, easing = EaseOutQuad)),
    label = "pulse",
)
val green = Color(0xFF22C55E)
Box(contentAlignment = Alignment.BottomEnd) {
    Box(
        Modifier
            .size(40.dp)
            .clip(CircleShape)
            .background(MaterialTheme.colorScheme.primaryContainer),
    )
    Box(Modifier.size(14.dp), contentAlignment = Alignment.Center) {
        Box(
            Modifier
                .size(10.dp)
                .graphicsLayer {
                    scaleX = pulse
                    scaleY = pulse
                    alpha = 2f - pulse
                }
                .background(green, CircleShape),
        )
        Box(
            Modifier
                .size(10.dp)
                .border(2.dp, MaterialTheme.colorScheme.surface, CircleShape)
                .background(green, CircleShape),
        )
    }
}