Cards
Cardsanimated

Live Stream Badge

Streaming card with animated live badge, viewer count and channel avatar.

LIVE3.2K watching

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 LiveStreamCard(channel: String, viewers: String) {
  val blink by rememberInfiniteTransition(label = "b")
    .animateFloat(
      initialValue = 0.3f,
      targetValue = 1f,
      animationSpec = infiniteRepeatable(
        tween(700), RepeatMode.Reverse,
      ),
      label = "blink",
    )
  Card(
    shape = RoundedCornerShape(18.dp),
    modifier = Modifier.fillMaxWidth(),
  ) {
    Box {
      Box(
        modifier = Modifier
          .fillMaxWidth()
          .height(130.dp)
          .background(
            Brush.linearGradient(
              listOf(Color(0xFF0F172A), Color(0xFF1E40AF)),
            ),
          ),
        contentAlignment = Alignment.Center,
      ) {
        Icon(
          Icons.Default.Videocam,
          contentDescription = null,
          tint = Color.White,
          modifier = Modifier.size(36.dp),
        )
      }
      Box(
        modifier = Modifier
          .align(Alignment.TopStart)
          .padding(10.dp)
          .graphicsLayer { alpha = blink }
          .clip(RoundedCornerShape(6.dp))
          .background(Color(0xFFDC2626))
          .padding(horizontal = 8.dp, vertical = 3.dp),
      ) {
        Text(
          "LIVE",
          color = Color.White,
          style = MaterialTheme.typography.labelSmall,
        )
      }
      Text(
        "$viewers watching",
        color = Color.White,
        style = MaterialTheme.typography.labelSmall,
        modifier = Modifier
          .align(Alignment.BottomStart)
          .padding(12.dp),
      )
    }
  }
}