Cards
Cardsanimated

KPI Delta Chip

A KPI value pairs with a colored delta chip and trend icon.

Conversion-2.1%
4.8%

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 KpiDeltaCard() {
  val v = remember { Animatable(0f) }
  LaunchedEffect(Unit) {
    v.animateTo(1f, tween(900, easing = FastOutSlowInEasing))
  }
  OutlinedCard(
    shape = RoundedCornerShape(18.dp),
    modifier = Modifier.width(260.dp),
  ) {
    Column(Modifier.padding(18.dp)) {
      Row(
        Modifier.fillMaxWidth(),
        horizontalArrangement = Arrangement.SpaceBetween,
        verticalAlignment = Alignment.CenterVertically,
      ) {
        Text(
          text = "Conversion",
          style = MaterialTheme.typography.labelMedium,
          color = MaterialTheme.colorScheme.onSurfaceVariant,
        )
        Surface(
          shape = RoundedCornerShape(50),
          color = Color(0xFFF43F5E).copy(alpha = 0.15f),
        ) {
          Text(
            text = "-2.1%",
            color = Color(0xFFF43F5E),
            style = MaterialTheme.typography.labelSmall,
            modifier = Modifier.padding(
              horizontal = 8.dp,
              vertical = 3.dp,
            ),
          )
        }
      }
      Spacer(Modifier.height(8.dp))
      Text(
        text = "%.1f%%".format(4.8f * v.value),
        style = MaterialTheme.typography.headlineMedium,
        fontWeight = FontWeight.Bold,
      )
    }
  }
}