Badges
Badgesanimated

Stock tick

A market chip where the arrow and percentage slide as the value updates.

+2.4%+2.4%

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 up by remember { mutableStateOf(true) }
LaunchedEffect(Unit) {
    while (true) { delay(2000); up = !up }
}
val color = if (up) Color(0xFF16A34A) else Color(0xFFDC2626)
Surface(
    shape = RoundedCornerShape(50),
    color = color.copy(alpha = 0.12f),
    contentColor = color,
) {
    Row(
        Modifier.padding(horizontal = 10.dp, vertical = 4.dp),
        verticalAlignment = Alignment.CenterVertically,
        horizontalArrangement = Arrangement.spacedBy(4.dp),
    ) {
        AnimatedContent(
            targetState = up,
            transitionSpec = {
                (slideInVertically { if (up) it else -it } + fadeIn()) togetherWith
                    (slideOutVertically { if (up) -it else it } + fadeOut())
            },
            label = "tick",
        ) { isUp ->
            Row(verticalAlignment = Alignment.CenterVertically) {
                Icon(
                    if (isUp) Icons.Filled.ArrowDropUp else Icons.Filled.ArrowDropDown,
                    contentDescription = null,
                    modifier = Modifier.size(16.dp),
                )
                Text(
                    if (isUp) "+2.4%" else "-1.1%",
                    fontSize = 12.sp,
                    fontWeight = FontWeight.SemiBold,
                )
            }
        }
    }
}