Cards
Cardsanimated

Step Count Ring

Animated circular progress ring sweeping toward the daily step target.

Steps

7,320

Goal 10,000

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 StepRingCard() {
  val target = 10000
  val steps = 7320
  val pct = steps / target.toFloat()
  val sweep by animateFloatAsState(
    targetValue = pct * 360f,
    animationSpec = tween(1200, easing = FastOutSlowInEasing),
    label = "sweep"
  )
  ElevatedCard(Modifier.fillMaxWidth()) {
    Row(
      Modifier.padding(20.dp),
      verticalAlignment = Alignment.CenterVertically
    ) {
      Box(
        Modifier.size(96.dp),
        contentAlignment = Alignment.Center
      ) {
        Canvas(Modifier.fillMaxSize()) {
          val stroke = 14f
          drawArc(
            Color(0xFFE0E0E0), 0f, 360f, false,
            style = Stroke(stroke, cap = StrokeCap.Round)
          )
          drawArc(
            Color(0xFF34C759), -90f, sweep, false,
            style = Stroke(stroke, cap = StrokeCap.Round)
          )
        }
        Text(
          "73%",
          style = MaterialTheme.typography.titleMedium
        )
      }
      Spacer(Modifier.width(20.dp))
      Column {
        Text(
          "Steps",
          color = MaterialTheme.colorScheme.onSurfaceVariant
        )
        Text(
          "7,320",
          style = MaterialTheme.typography.headlineSmall
        )
        Text(
          "Goal 10,000",
          style = MaterialTheme.typography.labelMedium
        )
      }
    }
  }
}