Jetpack Compose has no dedicated long-press menu primitive — you compose one from a combinedClickable modifier on the trigger view plus the existing controlled DropdownMenu. The menu anchors to the trigger automatically.
Use shadowElevation to set the popup shadow elevation in dp. Set it to 0 to remove the shadow, or omit it to use Material 3's default. Modifiers on DropdownMenu apply to the trigger container, so shadow modifiers do not change the popup shadow.
Use DropdownMenuPopup to show a Material 3 Expressive menu. It matches Compose's DropdownMenuPopup, which has no container of its own. The menu anchors to its parent, so put it in a Box next to the component that opens it. Put the items in DropdownMenuGroup components, with a 2 dp Spacer between the groups. The 2 dp height matches MenuDefaults.GroupSpacing in Compose.
Use SelectableDropdownMenuItem for a choice of one option, such as a sort order. It matches Compose's SelectableDropdownMenuItem. A selected item gets a highlighted container and shows its SelectedLeadingIcon in place of its LeadingIcon.
By default, each DropdownMenuGroup and SelectableDropdownMenuItem has the shape of a single element. To join them into one stack, set the position of each element as { index, count }:
shapes on DropdownMenuGroup: the position of the group in the menu.
shape on DropdownMenuItem, or shapes on SelectableDropdownMenuItem: the position of the item in its group.
The first element gets rounder top corners, and the last element gets rounder bottom corners. A DropdownMenuItem without shape is the original Material 3 menu item.
<DropdownMenuPopupexpanded={isExpanded}onDismissRequest={()=>setIsExpanded(false)}>{/* Group 1 of 2, with 2 items */}<DropdownMenuGroupshapes={{ index:0, count:2}}><DropdownMenuItemshape={{ index:0, count:2}}><DropdownMenuItem.Text><Text>Edit</Text></DropdownMenuItem.Text></DropdownMenuItem><DropdownMenuItemshape={{ index:1, count:2}}><DropdownMenuItem.Text><Text>Share</Text></DropdownMenuItem.Text></DropdownMenuItem></DropdownMenuGroup><Spacermodifiers={[height(2)]}/>{/* Group 2 of 2, with 1 item */}<DropdownMenuGroupshapes={{ index:1, count:2}}><DropdownMenuItemshape={{ index:0, count:1}}><DropdownMenuItem.Text><Text>Settings</Text></DropdownMenuItem.Text></DropdownMenuItem></DropdownMenuGroup></DropdownMenuPopup>
The contents of the submenu are used as an anchor for the dropdown menu.
The children will be wrapped in a pressable element, which triggers opening of the dropdown menu.
The position of the group in the menu, which sets its shape through Compose's
MenuDefaults.groupShape(index, count). Defaults to MenuDefaults.groupShapes(), the shape
of a single group.
tonalElevation
Android
Optional • Type: number
Tonal elevation of the group in dp. Defaults to MenuDefaults.TonalElevation.
The position of the item in its DropdownMenuGroup, which sets its shape through Compose's
MenuDefaults.itemShape(index, count).shape. When set, the item is a Material 3 Expressive
menu item and can show SupportingText.
A Material 3 Expressive menu that wraps Compose's DropdownMenuPopup. The menu anchors to its
parent, so it goes in a Box next to the component that opens it. Unlike DropdownMenu, it
has no container. It holds DropdownMenuGroup components, with a Spacer between the groups.
The side of the anchor where the menu opens, through Compose's MenuAnchorPosition. When
there is not sufficient space on that side, Compose moves the menu to a different side. Use
'end' for a submenu that opens next to its item.
The contents of the menu, typically DropdownMenuGroup components.
expanded
Android
Optional • Type: boolean
Whether the menu is expanded (visible).
modifiers
Android
Optional • Type: ModifierConfig[]
Modifiers for the contents of the menu.
onDismissRequest
Android
Optional • Type: () => void
Callback fired when the menu requests to be dismissed (for example, tapping outside).
Must be provided when expanded is true to allow the menu to close.
A Material 3 Expressive menu item that wraps Compose's SelectableDropdownMenuItem, for a
choice of one option. A selected item gets a highlighted container and shows its
SelectedLeadingIcon.
Props of the SelectableDropdownMenuItem component.
The position of the item in its DropdownMenuGroup, which sets its shape through Compose's
MenuDefaults.itemShape(index, count). Defaults to MenuDefaults.itemShapes(), the shape of a
single item.
The position of a group in a DropdownMenuPopup, or of an item in a group.
Compose's MenuDefaults.groupShape(index, count) and MenuDefaults.itemShape(index, count) use
it to round the outer corners of the first and last element.
Property
Type
Description
count
number
The number of groups in the menu, or of items in the group.
index
number
The index of the group in the menu, or of the item in its group.
PopupProperties
Android
Properties for the popup window, matching PopupProperties in Compose.
Property
Type
Description
clippingEnabled(optional)
boolean
Whether the popup window is clipped to the screen boundaries. Set to false to let it extend
beyond them, which positions the popup accurately.
Default:true
dismissOnBackPress(optional)
boolean
Whether the popup can be dismissed by pressing the back button. Has no effect when focusable is false.
Default:true
dismissOnClickOutside(optional)
boolean
Whether the popup can be dismissed by clicking outside of its bounds.
Default:true
focusable(optional)
boolean
Whether the popup is focusable. When true, the popup receives IME events and key presses,
such as the back button.
Default:true
SelectableDropdownMenuItemColors
Android
Color overrides for the SelectableDropdownMenuItem component. Each color defaults to the
value of Compose's MenuDefaults.selectableItemColors().