Disclosures
Disclosuresanimated

Media expander

A compact list row that expands to reveal a media thumbnail and caption.

Trip recap

Sunrise over the north ridge.

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 MediaExpander(title: String, caption: String) {
    var open by remember { mutableStateOf(false) }
    OutlinedCard(onClick = { open = !open }, Modifier.animateContentSize()) {
        Column(Modifier.padding(12.dp)) {
            Row(verticalAlignment = Alignment.CenterVertically) {
                Icon(Icons.Outlined.Image, null, tint = Color(0xFF8B5CF6))
                Spacer(Modifier.width(10.dp))
                Text(title, Modifier.weight(1f),
                    style = MaterialTheme.typography.titleSmall)
                Icon(
                    Icons.Filled.ExpandMore, null,
                    Modifier.rotate(if (open) 180f else 0f),
                )
            }
            AnimatedVisibility(open) {
                Column(Modifier.padding(top = 10.dp)) {
                    Box(
                        Modifier.fillMaxWidth().height(80.dp)
                            .clip(MaterialTheme.shapes.medium)
                            .background(MaterialTheme.colorScheme.surfaceVariant),
                    )
                    Text(caption, Modifier.padding(top = 6.dp),
                        style = MaterialTheme.typography.bodySmall,
                        color = MaterialTheme.colorScheme.onSurfaceVariant)
                }
            }
        }
    }
}