Cards
Cardsanimated

Goal Tracker

A horizontal goal bar fills toward a target with remaining hint.

Monthly Goal$6.8k / $10k

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 GoalTrackerCard() {
  val fill = remember { Animatable(0f) }
  LaunchedEffect(Unit) {
    fill.animateTo(0.68f, tween(1000, easing = FastOutSlowInEasing))
  }
  Card(
    shape = RoundedCornerShape(18.dp),
    modifier = Modifier.width(260.dp),
  ) {
    Column(Modifier.padding(18.dp)) {
      Row(
        Modifier.fillMaxWidth(),
        horizontalArrangement = Arrangement.SpaceBetween,
      ) {
        Text(text = "Monthly Goal", fontWeight = FontWeight.SemiBold)
        Text(
          text = "$6.8k / $10k",
          style = MaterialTheme.typography.bodySmall,
          color = MaterialTheme.colorScheme.onSurfaceVariant,
        )
      }
      Spacer(Modifier.height(12.dp))
      Box(
        Modifier
          .fillMaxWidth()
          .height(10.dp)
          .clip(RoundedCornerShape(50))
          .background(MaterialTheme.colorScheme.surfaceVariant),
      ) {
        Box(
          Modifier
            .fillMaxWidth(fill.value)
            .fillMaxHeight()
            .clip(RoundedCornerShape(50))
            .background(
              Brush.horizontalGradient(
                listOf(Color(0xFF8B5CF6), Color(0xFFEC4899)),
              ),
            ),
        )
      }
    }
  }
}