Cards
Cardsanimated

Warning Banner

A warning banner with a softly pulsing triangle status icon.

<Card className="w-64 mx-auto bg-amber-50 dark:bg-amber-950/40 border border-amber-300 dark:border-amber-800"> <CardContent className="flex items-center gap-3 p-4"> <AlertTriangle className="size-5 text-amber-600 dark:text-amber-400 animate-pulse" /> <span className="text-sm text-amber-800 dark:text-amber-200">Your subscription expires in 3 days.</span> </CardContent> </Card>

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 WarningBanner() {
    val pulse by rememberInfiniteTransition().animateFloat(
        initialValue = 0.6f,
        targetValue = 1f,
        animationSpec = infiniteRepeatable(
            tween(900), RepeatMode.Reverse
        )
    )
    Surface(
        shape = RoundedCornerShape(12.dp),
        color = Color(0xFFFEF3C7),
        modifier = Modifier.padding(12.dp)
    ) {
        Row(
            modifier = Modifier.padding(16.dp),
            verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = Arrangement.spacedBy(12.dp)
        ) {
            Icon(
                Icons.Rounded.Warning,
                contentDescription = null,
                tint = Color(0xFFB45309).copy(alpha = pulse)
            )
            Text(
                "Your subscription expires in 3 days.",
                color = Color(0xFF92400E)
            )
        }
    }
}