Cards
Cardsanimated

Percentage Ring

A bold gradient ring counts up its completion percentage in the center.

91%
Profile Complete

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 PercentageRingCard() {
  val p = remember { Animatable(0f) }
  LaunchedEffect(Unit) {
    p.animateTo(0.91f, tween(1300, easing = FastOutSlowInEasing))
  }
  ElevatedCard(
    shape = RoundedCornerShape(20.dp),
    modifier = Modifier.width(260.dp),
  ) {
    Column(
      Modifier
        .padding(20.dp)
        .fillMaxWidth(),
      horizontalAlignment = Alignment.CenterHorizontally,
    ) {
      Box(contentAlignment = Alignment.Center) {
        Canvas(Modifier.size(96.dp)) {
          drawArc(
            color = Color(0xFF334155).copy(alpha = 0.18f),
            startAngle = -90f,
            sweepAngle = 360f,
            useCenter = false,
            style = Stroke(10.dp.toPx(), cap = StrokeCap.Round),
          )
          drawArc(
            brush = Brush.sweepGradient(
              listOf(Color(0xFFEC4899), Color(0xFF8B5CF6)),
            ),
            startAngle = -90f,
            sweepAngle = 360f * p.value,
            useCenter = false,
            style = Stroke(10.dp.toPx(), cap = StrokeCap.Round),
          )
        }
        Text(
          text = "${(p.value * 100).toInt()}%",
          style = MaterialTheme.typography.headlineSmall,
          fontWeight = FontWeight.Bold,
        )
      }
      Spacer(Modifier.height(10.dp))
      Text(
        text = "Profile Complete",
        style = MaterialTheme.typography.bodySmall,
        color = MaterialTheme.colorScheme.onSurfaceVariant,
      )
    }
  }
}