Compose MenuProvider
An AndroidX MenuHost & MenuProvider-like API for Jetpack Compose!
Setup
kotlin {
sourceSets {
commonMain.dependencies {
val menuproviderVersion = "1.3.2"
implementation("io.github.boswelja.menuprovider:core:$menuproviderVersion")
implementation("io.github.boswelja.menuprovider:material3:$menuproviderVersion")
}
}
}
Usage
@Composable
fun MyComposable() {
ProvideCumulativeMenuHost {
Scaffold(
topBar = {
TopAppBar(
title = { Text("My Top Bar") },
actions = { AnimatedTopAppBarMenuItems() }
)
}
) {
MyMenuProvidingComposable()
}
}
}
@Composable
fun MyMenuProvidingComposable() {
ProvideMenuItems(
MenuItem(
label = "My Menu Item",
imageVector = Icons.Default.Add,
onClick = { performAction() },
isImportant = ,
)
)
}
Documentation
Docs are published with each release to https://boswelja.github.io/compose-menuprovider/.