# TextContextMenuProvider

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/provider/TextContextMenuProvider.kt+class:androidx.compose.foundation.text.contextmenu.provider.TextContextMenuProvider) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0) Common/All
- Cmn

  ```
  interface TextContextMenuProvider
  ```

*** ** * ** ***

The provider determines how the context menu is shown and its appearance.

The context menu can be customized by providing another implementation of this to `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/provider/package-summary#LocalTextContextMenuDropdownProvider()` or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/provider/package-summary#LocalTextContextMenuToolbarProvider()` via a `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalProvider.composable#CompositionLocalProvider(kotlin.Array,kotlin.Function0)`.

If you want to modify the contents of the context menu, see `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/modifier/appendTextContextMenuComponents.modifier#(androidx.compose.ui.Modifier).appendTextContextMenuComponents(kotlin.Function1)` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/modifier/filterTextContextMenuComponents.modifier#(androidx.compose.ui.Modifier).filterTextContextMenuComponents(kotlin.Function1)`

## Summary

| ### Public functions |
|---|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/provider/TextContextMenuProvider#showTextContextMenu(androidx.compose.foundation.text.contextmenu.provider.TextContextMenuDataProvider)(dataProvider: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/provider/TextContextMenuDataProvider)` Shows the text context menu. | Cmn |

## Public functions

### showTextContextMenu

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

```
suspend fun showTextContextMenu(dataProvider: TextContextMenuDataProvider): Unit
```

Shows the text context menu.

This function suspends until the context menu is closed. If the coroutine is cancelled, the context menu will be closed.

| Parameters |
|---|---|
| `dataProvider: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/provider/TextContextMenuDataProvider` | provides the data necessary to show the text context menu. |