Cards
Cards

Comment Thread

Threaded comment card showing nested replies with indentation and reply controls.

JD
Jade
Love this take!
RT
Rai
Totally agree.

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 CommentThreadCard() {
    OutlinedCard(
        modifier = Modifier.width(300.dp),
        shape = RoundedCornerShape(18.dp)
    ) {
        Column(Modifier.padding(16.dp)) {
            CommentRow("JD", "Jade", "Love this take!", 0)
            Spacer(Modifier.height(12.dp))
            CommentRow("RT", "Rai", "Totally agree.", 24)
        }
    }
}

@Composable
private fun CommentRow(
    initials: String, name: String,
    text: String, indent: Int
) {
    Row(Modifier.padding(start = indent.dp)) {
        Box(
            Modifier.size(32.dp).clip(CircleShape)
                .background(MaterialTheme.colorScheme.secondary),
            contentAlignment = Alignment.Center
        ) {
            Text(
                initials,
                style = MaterialTheme.typography.labelSmall
            )
        }
        Spacer(Modifier.width(10.dp))
        Column {
            Text(
                name,
                style = MaterialTheme.typography.labelLarge
            )
            Text(
                text,
                style = MaterialTheme.typography.bodySmall
            )
            Row {
                Icon(
                    Icons.Default.Reply,
                    contentDescription = "Reply",
                    modifier = Modifier.size(14.dp)
                )
                Spacer(Modifier.width(4.dp))
                Text(
                    "Reply",
                    style = MaterialTheme.typography.labelSmall
                )
            }
        }
    }
}