Cards
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 SeatMapCard() {
var sel by remember { mutableStateOf(-1) }
Card(modifier = Modifier.fillMaxWidth().padding(16.dp)) {
Column(Modifier.padding(20.dp)) {
Text("Select Seat",
style = MaterialTheme.typography.titleMedium)
Spacer(Modifier.height(12.dp))
repeat(3) { row ->
Row(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly
) {
repeat(4) { col ->
val idx = row * 4 + col
val on = sel == idx
val sc by animateFloatAsState(
if (on) 1.2f else 1f, label = "s"
)
Box(
Modifier.padding(4.dp).size(28.dp)
.graphicsLayer { scaleX = sc; scaleY = sc }
.background(
if (on) Color(0xFF6366F1)
else Color.Gray.copy(0.25f),
RoundedCornerShape(6.dp)
).clickable { sel = idx }
)
}
}
}
}
}
}