Cards
Cardsanimated

Budget Ring

Monthly budget card with a circular ring that fills to the spent ratio.

68%
Monthly Budget
$1,360 / $2,000
$640 left

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 BudgetRingCard() {
  val progress = remember { Animatable(0f) }
  LaunchedEffect(Unit) {
    progress.animateTo(0.68f, tween(1200, easing = FastOutSlowInEasing))
  }
  val ring = MaterialTheme.colorScheme.primary
  val track = MaterialTheme.colorScheme.surfaceVariant
  Card(
    modifier = Modifier.fillMaxWidth().padding(16.dp),
    shape = RoundedCornerShape(20.dp)
  ) {
    Row(
      Modifier.padding(20.dp),
      verticalAlignment = Alignment.CenterVertically
    ) {
      Box(contentAlignment = Alignment.Center) {
        Canvas(Modifier.size(86.dp)) {
          val sw = 12.dp.toPx()
          drawArc(
            track, 0f, 360f, false,
            style = Stroke(sw, cap = StrokeCap.Round)
          )
          drawArc(
            ring, -90f, 360f * progress.value, false,
            style = Stroke(sw, cap = StrokeCap.Round)
          )
        }
        Text(
          "${(progress.value * 100).toInt()}%",
          fontWeight = FontWeight.Bold
        )
      }
      Spacer(Modifier.width(18.dp))
      Column {
        Text("Monthly Budget",
          style = MaterialTheme.typography.labelMedium)
        Text("$1,360 / $2,000",
          style = MaterialTheme.typography.titleMedium,
          fontWeight = FontWeight.SemiBold)
        Text("$640 left",
          style = MaterialTheme.typography.bodySmall,
          color = MaterialTheme.colorScheme.onSurfaceVariant)
      }
    }
  }
}