New Compose Multiplatform components arrived on Composables UICheck it out →

Component in Compose Foundation

ContextMenuArea

Desktop

Defines a container where context menu is available. Menu is triggered by right mouse clicks. Representation of menu is defined by [LocalContextMenuRepresentation]`

Last updated:

Installation

dependencies {
   implementation("androidx.compose.foundation:foundation:1.7.0-beta04")
}

Overloads

@Composable
fun ContextMenuArea(
    items: () -> List<ContextMenuItem>,
    state: ContextMenuState = remember { ContextMenuState() },
    enabled: Boolean = true,
    content: @Composable () -> Unit
)

Parameters

namedescription
itemsList of context menu items. Final context menu contains all items from descendant [ContextMenuArea] and [ContextMenuDataProvider].
state[ContextMenuState] of menu controlled by this area.
enabledIf false then gesture detector is disabled.
contentThe content of the [ContextMenuArea].