Cards
Cardsanimated

Live Activity Pulse

A pulsing dot signals live traffic next to a real-time counter.

1,284 online
Live right now

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 LiveActivityPulseCard() {
  val t = rememberInfiniteTransition(label = "pulse")
  val r by t.animateFloat(
    initialValue = 0f,
    targetValue = 1f,
    animationSpec = infiniteRepeatable(
      tween(1400, easing = FastOutSlowInEasing),
    ),
    label = "r",
  )
  Card(
    shape = RoundedCornerShape(18.dp),
    modifier = Modifier.width(260.dp),
  ) {
    Row(
      Modifier.padding(18.dp),
      verticalAlignment = Alignment.CenterVertically,
    ) {
      Canvas(Modifier.size(20.dp)) {
        drawCircle(
          color = Color(0xFF22C55E).copy(alpha = 1f - r),
          radius = size.minDimension / 2f * (0.4f + r * 0.6f),
        )
        drawCircle(
          color = Color(0xFF22C55E),
          radius = size.minDimension / 5f,
        )
      }
      Spacer(Modifier.width(14.dp))
      Column {
        Text(
          text = "1,284 online",
          fontWeight = FontWeight.Bold,
        )
        Text(
          text = "Live right now",
          style = MaterialTheme.typography.bodySmall,
          color = MaterialTheme.colorScheme.onSurfaceVariant,
        )
      }
    }
  }
}