Cards
Cardsanimated

Credit Card Shimmer

Gradient credit card with a sweeping shimmer sheen across its glossy face.

•••• •••• •••• 4827
Ava Carter

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 CreditShimmerCard() {
  val t = rememberInfiniteTransition(label = "sheen")
  val x by t.animateFloat(
    -300f, 600f,
    infiniteRepeatable(tween(2200), RepeatMode.Restart),
    label = "x"
  )
  Card(
    modifier = Modifier
      .fillMaxWidth()
      .padding(16.dp)
      .height(190.dp),
    shape = RoundedCornerShape(20.dp)
  ) {
    Box(
      Modifier
        .fillMaxSize()
        .background(
          Brush.linearGradient(
            listOf(Color(0xFF1E293B), Color(0xFF0F172A))
          )
        )
        .drawWithContent {
          drawContent()
          drawRect(
            Brush.linearGradient(
              listOf(
                Color.Transparent,
                Color.White.copy(alpha = 0.18f),
                Color.Transparent
              ),
              start = Offset(x, 0f),
              end = Offset(x + 160f, size.height)
            )
          )
        }
        .padding(20.dp)
    ) {
      Column(Modifier.fillMaxSize()) {
        Icon(
          Icons.Filled.CreditCard, null,
          tint = Color.White.copy(alpha = 0.9f)
        )
        Spacer(Modifier.weight(1f))
        Text(
          "**** **** **** 4827",
          color = Color.White,
          letterSpacing = 2.sp,
          style = MaterialTheme.typography.titleMedium
        )
        Spacer(Modifier.height(8.dp))
        Text(
          "AVA CARTER",
          color = Color.White.copy(alpha = 0.7f),
          style = MaterialTheme.typography.labelSmall
        )
      }
    }
  }
}