Cards
Cards

Permission Request

A permission prompt asking the user to allow notifications.

<Card className="w-64 mx-auto"> <CardHeader className="gap-2"> <BellRing className="size-6 text-primary" /> <CardTitle className="text-base">Enable notifications?</CardTitle> <CardDescription>Stay updated on replies and mentions.</CardDescription> </CardHeader> <CardFooter className="gap-2 justify-end"> <Button variant="ghost" className="text-xs">Not now</Button> <Button className="text-xs">Allow</Button> </CardFooter> </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 PermissionRequest(onAllow: () -> Unit, onDeny: () -> Unit) {
    ElevatedCard(
        shape = RoundedCornerShape(16.dp),
        modifier = Modifier.padding(12.dp)
    ) {
        Column(
            modifier = Modifier.padding(18.dp),
            verticalArrangement = Arrangement.spacedBy(12.dp)
        ) {
            Icon(
                Icons.Rounded.Notifications,
                contentDescription = null,
                tint = MaterialTheme.colorScheme.primary
            )
            Text(
                "Enable notifications?",
                style = MaterialTheme.typography.titleMedium
            )
            Text(
                "Stay updated on replies and mentions.",
                style = MaterialTheme.typography.bodySmall,
                color = MaterialTheme.colorScheme.onSurfaceVariant
            )
            Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
                TextButton(onClick = onDeny) { Text("Not now") }
                Button(onClick = onAllow) { Text("Allow") }
            }
        }
    }
}