Cards
Cardsanimated

Score Card

A large credit-style score animates within a colored qualitative band.

Credit Score742Very Good

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 ScoreCard() {
  val p = remember { Animatable(0f) }
  LaunchedEffect(Unit) {
    p.animateTo(1f, tween(1300, easing = FastOutSlowInEasing))
  }
  val score = (300 + (742 - 300) * p.value).toInt()
  ElevatedCard(
    shape = RoundedCornerShape(20.dp),
    modifier = Modifier.width(260.dp),
  ) {
    Column(
      Modifier
        .padding(20.dp)
        .fillMaxWidth(),
      horizontalAlignment = Alignment.CenterHorizontally,
    ) {
      Text(
        text = "Credit Score",
        style = MaterialTheme.typography.labelMedium,
        color = MaterialTheme.colorScheme.onSurfaceVariant,
      )
      Text(
        text = "$score",
        style = MaterialTheme.typography.displaySmall,
        fontWeight = FontWeight.Bold,
        color = Color(0xFF22C55E),
      )
      Surface(
        shape = RoundedCornerShape(50),
        color = Color(0xFF22C55E).copy(alpha = 0.15f),
      ) {
        Text(
          text = "Very Good",
          color = Color(0xFF22C55E),
          style = MaterialTheme.typography.labelSmall,
          modifier = Modifier.padding(
            horizontal = 10.dp,
            vertical = 4.dp,
          ),
        )
      }
    }
  }
}