Cards
Cardsanimated

Audiobook Progress

Audiobook card showing chapter, remaining time and an animated progress bar.

The Long Echo
Chapter 9
2h 14m 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 AudiobookProgress(title: String, chapter: String) {
  val progress by animateFloatAsState(
    targetValue = 0.73f,
    animationSpec = tween(900),
    label = "ab",
  )
  Card(
    shape = RoundedCornerShape(20.dp),
    modifier = Modifier.fillMaxWidth(),
  ) {
    Column(Modifier.padding(16.dp)) {
      Row {
        Box(
          modifier = Modifier
            .size(56.dp)
            .clip(RoundedCornerShape(10.dp))
            .background(
              Brush.linearGradient(
                listOf(Color(0xFF92400E), Color(0xFFB45309)),
              ),
            ),
          contentAlignment = Alignment.Center,
        ) {
          Icon(
            Icons.Default.Headphones,
            contentDescription = null,
            tint = Color.White,
          )
        }
        Spacer(Modifier.width(14.dp))
        Column {
          Text(title, style = MaterialTheme.typography.titleSmall)
          Text(chapter, style = MaterialTheme.typography.bodySmall)
        }
      }
      Spacer(Modifier.height(14.dp))
      LinearProgressIndicator(
        progress = { progress },
        modifier = Modifier
          .fillMaxWidth()
          .height(6.dp)
          .clip(RoundedCornerShape(3.dp)),
      )
      Spacer(Modifier.height(6.dp))
      Text(
        "2h 14m left",
        style = MaterialTheme.typography.labelSmall,
        color = MaterialTheme.colorScheme.onSurfaceVariant,
      )
    }
  }
}