TextContextMenuItem

Class

Android
class TextContextMenuItem(
    key: Any,
    val label: String,
    val leadingIcon: Int = Resources.ID_NULL,
    val onClick: TextContextMenuSession.() -> Unit,
) : TextContextMenuComponent(key)

A TextContextMenuComponent that represents a clickable item with a label in a context menu.

Parameters

keyA unique key that identifies this component, mainly for use in filtering a component in Modifier.filterTextContextMenuComponents. It is advisable to use a data object as a key here.
labelThe label text to be shown in the context menu.
leadingIconIcon that precedes the label in the context menu. This is a drawable resource reference.
onClickThe action to be performed when this item is clicked. Call TextContextMenuSession.close on the TextContextMenuSession receiver to close the context menu item as a result of the click.