An AndroidX MenuHost & MenuProvider-like API for Jetpack Compose!
kotlin {
sourceSets {
commonMain.dependencies {
val menuproviderVersion = "1.3.2"
// Core provides a generic implementation fit for any design system
implementation("io.github.boswelja.menuprovider:core:$menuproviderVersion")
// material3 contains opinionated components to streamline development
implementation("io.github.boswelja.menuprovider:material3:$menuproviderVersion")
}
}
}
@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 = true,
)
)
}
Docs are published with each release to https://boswelja.github.io/compose-menuprovider/.