Menus
Menus

Checkable menu

A menu of toggleable rows for showing and hiding columns without closing.

Name
Status
Owner

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 ColumnsMenu() {
    var open by remember { mutableStateOf(false) }
    val cols = remember {
        mutableStateMapOf("Name" to true, "Status" to true, "Owner" to false)
    }
    Box {
        OutlinedButton(onClick = { open = true }) { Text("Columns") }
        DropdownMenu(expanded = open, onDismissRequest = { open = false }) {
            cols.forEach { (label, on) ->
                DropdownMenuItem(
                    text = { Text(label) },
                    leadingIcon = {
                        Checkbox(checked = on, onCheckedChange = { cols[label] = it })
                    },
                    onClick = { cols[label] = !on },
                )
            }
        }
    }
}