Cards
Cardsanimated

Video Thumbnail

Video preview card with gradient poster, duration badge and a hover play overlay.

12:04
Building a Synth from Scratch

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 VideoThumb(title: String, duration: String) {
  var hover by remember { mutableStateOf(false) }
  val scale by animateFloatAsState(
    targetValue = if (hover) 1.08f else 1f,
    animationSpec = spring(),
    label = "scale",
  )
  Card(
    shape = RoundedCornerShape(18.dp),
    modifier = Modifier.fillMaxWidth(),
  ) {
    Column {
      Box(
        modifier = Modifier
          .fillMaxWidth()
          .height(140.dp)
          .graphicsLayer { scaleX = scale; scaleY = scale }
          .background(
            Brush.linearGradient(
              listOf(Color(0xFF1E293B), Color(0xFF7C3AED)),
            ),
          ),
        contentAlignment = Alignment.Center,
      ) {
        Icon(
          Icons.Default.PlayArrow,
          contentDescription = null,
          tint = Color.White,
          modifier = Modifier.size(40.dp),
        )
        Box(
          modifier = Modifier
            .align(Alignment.BottomEnd)
            .padding(8.dp)
            .clip(RoundedCornerShape(6.dp))
            .background(Color(0xCC000000))
            .padding(horizontal = 6.dp, vertical = 2.dp),
        ) {
          Text(
            duration,
            color = Color.White,
            style = MaterialTheme.typography.labelSmall,
          )
        }
      }
      Text(
        title,
        style = MaterialTheme.typography.titleSmall,
        modifier = Modifier.padding(12.dp),
      )
    }
  }
}