Cards
Cardsanimated

Period Comparison

Two stacked bars compare this period against the previous one.

Orders
This week
Last week

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 PeriodComparisonCard() {
  val a = remember { Animatable(0f) }
  val b = remember { Animatable(0f) }
  LaunchedEffect(Unit) {
    a.animateTo(0.85f, tween(900))
    b.animateTo(0.6f, tween(900))
  }
  OutlinedCard(
    shape = RoundedCornerShape(18.dp),
    modifier = Modifier.width(260.dp),
  ) {
    Column(Modifier.padding(18.dp)) {
      Text(text = "Orders", fontWeight = FontWeight.SemiBold)
      Spacer(Modifier.height(14.dp))
      listOf(
        Triple("This week", a, Color(0xFF6366F1)),
        Triple("Last week", b, Color(0xFF94A3B8)),
      ).forEach { (label, anim, c) ->
        Text(
          text = label,
          style = MaterialTheme.typography.labelSmall,
          color = MaterialTheme.colorScheme.onSurfaceVariant,
        )
        Box(
          Modifier
            .fillMaxWidth()
            .height(12.dp)
            .clip(RoundedCornerShape(50))
            .background(MaterialTheme.colorScheme.surfaceVariant),
        ) {
          Box(
            Modifier
              .fillMaxWidth(anim.value)
              .fillMaxHeight()
              .clip(RoundedCornerShape(50))
              .background(c),
          )
        }
        Spacer(Modifier.height(10.dp))
      }
    }
  }
}