Feedback
Feedback

Warning banner

An amber banner that surfaces a caution with an action and a dismiss control.

Card expires soonFix

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(message: String, onFix: () -> Unit, onDismiss: () -> Unit) {
    val amber = Color(0xFFD97706)
    Surface(color = amber.copy(alpha = 0.12f), shape = MaterialTheme.shapes.medium) {
        Row(Modifier.padding(12.dp), verticalAlignment = Alignment.CenterVertically) {
            Icon(Icons.Filled.WarningAmber, null, tint = amber)
            Spacer(Modifier.width(10.dp))
            Text(message, Modifier.weight(1f),
                style = MaterialTheme.typography.bodySmall)
            TextButton(onClick = onFix) { Text("Fix", color = amber) }
            IconButton(onClick = onDismiss) {
                Icon(Icons.Filled.Close, "Dismiss", Modifier.size(16.dp))
            }
        }
    }
}