Cards
Cardsanimated

Balance Count Up

Account balance card animating its total with a smooth count-up reveal.

Total Balance
$12,480.55
+2.4% this month

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 BalanceCountUpCard() {
  val target = 12480.55f
  val anim = remember { Animatable(0f) }
  LaunchedEffect(Unit) {
    anim.animateTo(
      target,
      tween(1400, easing = FastOutSlowInEasing)
    )
  }
  ElevatedCard(
    modifier = Modifier
      .fillMaxWidth()
      .padding(16.dp),
    shape = RoundedCornerShape(24.dp)
  ) {
    Column(Modifier.padding(20.dp)) {
      Text(
        "Total Balance",
        style = MaterialTheme.typography.labelMedium,
        color = MaterialTheme.colorScheme.onSurfaceVariant
      )
      Spacer(Modifier.height(6.dp))
      Text(
        "$" + "%,.2f".format(anim.value),
        style = MaterialTheme.typography.displaySmall,
        fontWeight = FontWeight.Bold
      )
      Spacer(Modifier.height(10.dp))
      Row(verticalAlignment = Alignment.CenterVertically) {
        Icon(
          Icons.Filled.TrendingUp,
          null,
          tint = Color(0xFF22C55E),
          modifier = Modifier.size(16.dp)
        )
        Spacer(Modifier.width(4.dp))
        Text(
          "+2.4% this month",
          style = MaterialTheme.typography.bodySmall,
          color = Color(0xFF22C55E)
        )
      }
    }
  }
}