← Compose Multiplatform Component in Material Compose
CursorDropdownMenu
Desktop
A [CursorDropdownMenu] behaves similarly to [Popup] and will use the current position of the mouse cursor to position itself on screen.
The [content] of a [CursorDropdownMenu] will typically be [DropdownMenuItem]s, as well as custom content. Using [DropdownMenuItem]s will result in a menu that matches the Material specification for menus.
Last updated:
Installation
dependencies {
implementation("androidx.compose.material:material:1.7.0-beta04")
}
Overloads
@Composable
@Deprecated(
level = DeprecationLevel.HIDDEN,
replaceWith = ReplaceWith(
expression = "CursorDropdownMenu(expanded,onDismissRequest, focusable, modifier, " +
"rememberScrollState(), content)",
"androidx.compose.foundation.rememberScrollState"
),
message = "Replaced by a CursorDropdownMenu function with a ScrollState parameter"
fun CursorDropdownMenu(
expanded: Boolean,
onDismissRequest: () -> Unit,
focusable: Boolean = true,
modifier: Modifier = Modifier,
content: @Composable ColumnScope.() -> Unit
)
Parameters
name | description |
---|---|
expanded | Whether the menu is currently open and visible to the user |
onDismissRequest | Called when the user requests to dismiss the menu, such as by tapping outside the menu's bounds |
focusable | Sets the ability for the menu to capture focus |
modifier | The modifier for this layout. |
content | The content lambda. |
@Composable
fun CursorDropdownMenu(
expanded: Boolean,
onDismissRequest: () -> Unit,
focusable: Boolean = true,
modifier: Modifier = Modifier,
scrollState: ScrollState = rememberScrollState(),
content: @Composable ColumnScope.() -> Unit
)
Parameters
name | description |
---|---|
expanded | Whether the menu is currently open and visible to the user |
onDismissRequest | Called when the user requests to dismiss the menu, such as by tapping outside the menu's bounds |
focusable | Whether the dropdown can capture focus |
modifier | [Modifier] to be applied to the menu's content |
scrollState | a [ScrollState] to used by the menu's content for items vertical scrolling |
content | the content of this dropdown menu, typically a [DropdownMenuItem] |