Cards
Cardsanimated

Spending Bars

Spending by category card with bars that grow upward on first render.

Spending
Food
Bills
Fun
Travel

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 SpendingBarsCard() {
  val data = listOf(
    "Food" to 0.8f, "Bills" to 0.55f,
    "Fun" to 0.4f, "Travel" to 0.65f
  )
  val grow = remember { Animatable(0f) }
  LaunchedEffect(Unit) { grow.animateTo(1f, tween(900)) }
  val bar = MaterialTheme.colorScheme.primary
  Card(
    modifier = Modifier.fillMaxWidth().padding(16.dp),
    shape = RoundedCornerShape(20.dp)
  ) {
    Column(Modifier.padding(18.dp)) {
      Row(verticalAlignment = Alignment.CenterVertically) {
        Icon(Icons.Filled.BarChart3, null,
          modifier = Modifier.size(18.dp))
        Spacer(Modifier.width(8.dp))
        Text("Spending",
          style = MaterialTheme.typography.titleSmall,
          fontWeight = FontWeight.SemiBold)
      }
      Spacer(Modifier.height(16.dp))
      Row(
        Modifier.fillMaxWidth().height(90.dp),
        horizontalArrangement = Arrangement.SpaceEvenly,
        verticalAlignment = Alignment.Bottom
      ) {
        data.forEach { (label, h) ->
          Column(horizontalAlignment = Alignment.CenterHorizontally) {
            Box(
              Modifier
                .width(18.dp)
                .fillMaxHeight(h * grow.value)
                .clip(RoundedCornerShape(6.dp))
                .background(bar)
            )
            Spacer(Modifier.height(6.dp))
            Text(label,
              style = MaterialTheme.typography.labelSmall)
          }
        }
      }
    }
  }
}