Disclosures
Is it free?
Yes. Copy any component and ship it, no attribution required.
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 Accordion(title: String, body: String) {
var open by remember { mutableStateOf(false) }
val rotation by animateFloatAsState(
targetValue = if (open) 180f else 0f,
animationSpec = tween(250, easing = EaseOutCubic),
label = "chevron",
)
OutlinedCard(onClick = { open = !open }) {
Column(Modifier.padding(16.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
title,
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.titleSmall,
)
Icon(
Icons.Filled.ExpandMore,
contentDescription = if (open) "Collapse" else "Expand",
modifier = Modifier.rotate(rotation),
)
}
AnimatedVisibility(visible = open) {
Text(
body,
modifier = Modifier.padding(top = 8.dp),
color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodyMedium,
)
}
}
}
}