# TextContextMenuItem

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/text/contextmenu/data/TextContextMenuData.android.kt+class:androidx.compose.foundation.text.contextmenu.data.TextContextMenuItem) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0) Common/AllAndroid/JVM
- android

  ```
  class TextContextMenuItem : TextContextMenuComponent
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.compose.foundation.text.contextmenu.data.TextContextMenuComponent](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuComponent) ||
|   | ↳ | [androidx.compose.foundation.text.contextmenu.data.TextContextMenuItem](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuItem) |

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuComponent` that represents a clickable item with a label in a context menu.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuItem#TextContextMenuItem(kotlin.Any,kotlin.String,kotlin.Int,kotlin.Function1)( key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html, label: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, leadingIcon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, onClick: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuSession.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` | android |

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuItem#toString()()` | android |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuItem#label()` The label text to be shown in the context menu. | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuItem#leadingIcon()` Icon that precedes the label in the context menu. | android |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuSession.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuItem#onClick()` The action to be performed when this item is clicked. | android |

| ### Inherited properties |
|---|
| From [androidx.compose.foundation.text.contextmenu.data.TextContextMenuComponent](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuComponent) |---|---|---| | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuComponent#key()` A unique key that identifies this component, mainly for use in filtering a component in `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/modifier/filterTextContextMenuComponents.modifier#(androidx.compose.ui.Modifier).filterTextContextMenuComponents(kotlin.Function1)`. | android | |

## Public constructors

### TextContextMenuItem

android Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)

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

| Parameters |
|---|---|
| `key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html` | A unique key that identifies this component, mainly for use in filtering a component in `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/modifier/filterTextContextMenuComponents.modifier#(androidx.compose.ui.Modifier).filterTextContextMenuComponents(kotlin.Function1)`. It is advisable to use a `data object` as a key here. |
| `label: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The label text to be shown in the context menu. |
| `leadingIcon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = Resources.ID_NULL` | Icon that precedes the label in the context menu. This is a drawable resource reference. |
| `onClick: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuSession.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The action to be performed when this item is clicked. Call `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuSession#close()` on the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuSession` receiver to close the context menu item as a result of the click. |

## Public functions

### toString

android

```
open fun toString(): String
```

## Public properties

### label

android Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)

```
val label: String
```

The label text to be shown in the context menu.

### leadingIcon

android Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)

```
val leadingIcon: Int
```

Icon that precedes the label in the context menu. This is a drawable resource reference.

### onClick

android Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)

```
val onClick: TextContextMenuSession.() -> Unit
```

The action to be performed when this item is clicked. Call `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuSession#close()` on the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuSession` receiver to close the context menu item as a result of the click.