State of Compose 2023 results are in! Click here to learn more

← Back to Material 3 Compose

DropdownMenuItem

Component
in
Material 3
. Since 1.0.0

Overview

Code Examples

<a href="https://m3.material.io/components/menus/overview" class="external" target="_blank">Material Design dropdown menu</a> item.

Menus display a list of choices on a temporary surface. They appear when users interact with a button, action, or other control.

!Dropdown menu image(https://developer.android.com/images/reference/androidx/compose/material3/menu.png)

Overloads

@Composable
fun DropdownMenuItem(
    text: @Composable () -> Unit,
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    leadingIcon: @Composable (() -> Unit)? = null,
    trailingIcon: @Composable (() -> Unit)? = null,
    enabled: Boolean = true,
    colors: MenuItemColors = MenuDefaults.itemColors(),
    contentPadding: PaddingValues = MenuDefaults.DropdownMenuItemContentPadding,
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
)

Parameters

NameDescription
texttext of the menu item
onClickcalled when this menu item is clicked
modifierthe Modifier to be applied to this menu item
leadingIconoptional leading icon to be displayed at the beginning of the item's text
trailingIconoptional trailing icon to be displayed at the end of the item's text. This trailing icon slot can also accept Text to indicate a keyboard shortcut.
enabledcontrols the enabled state of this menu item. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.
colorsMenuItemColors that will be used to resolve the colors used for this menu item in different states. See MenuDefaults.itemColors.
contentPaddingthe padding applied to the content of this menu item
interactionSourcethe MutableInteractionSource representing the stream of Interactions for this menu item. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this menu item in different states