Cards
Cardsanimated

Mindfulness Breathe

Breathing coach card with a circle that expands and contracts on a calm loop.

Breathe in

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 BreatheCard() {
  val t = rememberInfiniteTransition(label = "breathe")
  val scale by t.animateFloat(
    0.6f, 1f,
    infiniteRepeatable(
      tween(4000, easing = FastOutSlowInEasing),
      repeatMode = RepeatMode.Reverse
    ), label = "scale"
  )
  ElevatedCard(Modifier.fillMaxWidth()) {
    Column(
      Modifier.padding(24.dp),
      horizontalAlignment = Alignment.CenterHorizontally
    ) {
      Box(
        Modifier.size(120.dp),
        contentAlignment = Alignment.Center
      ) {
        Canvas(Modifier.fillMaxSize()) {
          drawCircle(
            Color(0xFF5AC8FA).copy(alpha = 0.25f),
            radius = size.minDimension / 2 * scale
          )
          drawCircle(
            Color(0xFF5AC8FA),
            radius = size.minDimension / 3 * scale
          )
        }
      }
      Spacer(Modifier.height(16.dp))
      Text(
        if (scale > 0.8f) "Breathe in" else "Breathe out",
        style = MaterialTheme.typography.titleMedium
      )
    }
  }
}