Cards
Cardsanimated

Virtual Card Reveal

Virtual card whose masked number unblurs into full digits on reveal tap.

VIRTUAL
•••• •••• •••• ••••

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 VirtualCardRevealCard() {
  var shown by remember { mutableStateOf(false) }
  val blur by animateDpAsState(
    if (shown) 0.dp else 8.dp, label = "blur"
  )
  Card(
    modifier = Modifier.fillMaxWidth().padding(16.dp).height(180.dp),
    shape = RoundedCornerShape(20.dp)
  ) {
    Box(
      Modifier.fillMaxSize().background(
        Brush.linearGradient(
          listOf(Color(0xFF7C3AED), Color(0xFF4F46E5))
        )
      ).padding(20.dp)
    ) {
      Column(Modifier.fillMaxSize()) {
        Row(verticalAlignment = Alignment.CenterVertically) {
          Icon(Icons.Filled.Lock, null, tint = Color.White)
          Spacer(Modifier.weight(1f))
          Text("VIRTUAL", color = Color.White.copy(alpha = 0.8f),
            style = MaterialTheme.typography.labelSmall)
        }
        Spacer(Modifier.weight(1f))
        Text(
          if (shown) "4012 8842 1990 7755" else "•••• •••• •••• ••••",
          color = Color.White,
          letterSpacing = 2.sp,
          modifier = Modifier.blur(blur)
        )
        Spacer(Modifier.height(12.dp))
        TextButton(onClick = { shown = !shown }) {
          Text(if (shown) "Hide" else "Reveal",
            color = Color.White)
        }
      }
    }
  }
}