Badges
Badgesanimated

Avatar stack

An overlapping avatar group whose remaining-member count rolls upward.

+5+6

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
var extra by remember { mutableIntStateOf(5) }
LaunchedEffect(Unit) {
    while (true) { delay(1800); extra = extra % 9 + 1 }
}
val colors = listOf(Color(0xFF6366F1), Color(0xFF22C55E), Color(0xFFF59E0B))
Row(horizontalArrangement = Arrangement.spacedBy((-8).dp)) {
    colors.forEach { c ->
        Box(
            Modifier
                .size(26.dp)
                .border(2.dp, MaterialTheme.colorScheme.surface, CircleShape)
                .clip(CircleShape)
                .background(c),
        )
    }
    Box(
        Modifier
            .size(26.dp)
            .border(2.dp, MaterialTheme.colorScheme.surface, CircleShape)
            .clip(CircleShape)
            .background(MaterialTheme.colorScheme.surfaceVariant),
        contentAlignment = Alignment.Center,
    ) {
        AnimatedContent(
            targetState = extra,
            transitionSpec = {
                (slideInVertically { it } + fadeIn()) togetherWith
                    (slideOutVertically { -it } + fadeOut())
            },
            label = "extra",
        ) { n ->
            Text("+$n", fontSize = 10.sp, fontWeight = FontWeight.SemiBold)
        }
    }
}