Cards
Cardsanimated

Run Distance

Distance goal card with an animated horizontal track and runner progress.

8.2 / 12 km

68% of weekly goal

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 RunDistanceCard() {
  val prog by animateFloatAsState(
    targetValue = 0.68f,
    animationSpec = tween(1200), label = "p"
  )
  ElevatedCard(Modifier.fillMaxWidth()) {
    Column(Modifier.padding(20.dp)) {
      Row(verticalAlignment = Alignment.CenterVertically) {
        Box(
          Modifier.size(28.dp).background(
            MaterialTheme.colorScheme.primary, CircleShape
          )
        )
        Spacer(Modifier.width(10.dp))
        Text(
          "8.2 / 12 km",
          style = MaterialTheme.typography.headlineSmall
        )
      }
      Spacer(Modifier.height(16.dp))
      Box(
        Modifier.fillMaxWidth().height(10.dp).background(
          MaterialTheme.colorScheme.surfaceVariant,
          CircleShape
        )
      ) {
        Box(
          Modifier
            .fillMaxWidth(prog)
            .height(10.dp)
            .background(
              MaterialTheme.colorScheme.primary,
              CircleShape
            )
        )
      }
      Spacer(Modifier.height(8.dp))
      Text(
        "68% of weekly goal",
        style = MaterialTheme.typography.labelMedium
      )
    }
  }
}