Disclosures
Disclosuresanimated
Filter group
A collapsible filter section showing an applied-count badge when closed.
Brand
2
Price
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 FilterGroup(title: String, applied: Int, options: List<String>) {
var open by remember { mutableStateOf(false) }
val rotation by animateFloatAsState(if (open) 180f else 0f, label = "fg")
Column {
Row(
Modifier.fillMaxWidth().clickable { open = !open }.padding(vertical = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(title, Modifier.weight(1f), style = MaterialTheme.typography.titleSmall)
if (applied > 0 && !open) {
Badge { Text("$applied") }
Spacer(Modifier.width(8.dp))
}
Icon(Icons.Filled.ExpandMore, null, Modifier.rotate(rotation))
}
AnimatedVisibility(open) {
Column {
options.forEach { o ->
Row(verticalAlignment = Alignment.CenterVertically) {
Checkbox(checked = false, onCheckedChange = {})
Text(o, style = MaterialTheme.typography.bodyMedium)
}
}
}
}
}
}