# TextContextMenuDataProvider

# TextContextMenuDataProvider

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.TextContextMenuDataProvider)  
Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)
Common/All
  - Cmn  

  ```
  interface TextContextMenuDataProvider
  ```

*** ** * ** ***

Provides the data necessary to show the text context menu.

All functions on this interface are expected to be snapshot-aware.

## Summary

|                                                            ### Public functions                                                             |
|---------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [Rect](https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect)                                                    | [contentBounds](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/provider/TextContextMenuDataProvider#contentBounds(androidx.compose.ui.layout.LayoutCoordinates))`(destinationCoordinates: `[LayoutCoordinates](https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/LayoutCoordinates)`)` Provides a bounding box to place the context menu around. | Cmn |
| [TextContextMenuData](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/data/TextContextMenuData) | [data](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/provider/TextContextMenuDataProvider#data())`()` Provides the components used to fill the context menu.                                                                                                                                                                                                            | Cmn |
| [Offset](https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)                                                | [position](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/provider/TextContextMenuDataProvider#position(androidx.compose.ui.layout.LayoutCoordinates))`(destinationCoordinates: `[LayoutCoordinates](https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/LayoutCoordinates)`)` Provides the position to place the context menu around.             | Cmn |

## Public functions

### contentBounds

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

```
fun contentBounds(destinationCoordinates: LayoutCoordinates): Rect
```

Provides a bounding box to place the context menu around. The position should be relative to the provided[destinationCoordinates](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/provider/TextContextMenuDataProvider#contentBounds(androidx.compose.ui.layout.LayoutCoordinates)).

This function is snapshot-aware.  

### data

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

```
fun data(): TextContextMenuData
```

Provides the components used to fill the context menu.

This function is snapshot-aware.  

### position

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

```
fun position(destinationCoordinates: LayoutCoordinates): Offset
```

Provides the position to place the context menu around. The position should be relative to the provided[destinationCoordinates](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/contextmenu/provider/TextContextMenuDataProvider#position(androidx.compose.ui.layout.LayoutCoordinates)).

This function is snapshot-aware.