# TextToolbar

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/platform/TextToolbar.kt+class:androidx.compose.ui.platform.TextToolbar) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface TextToolbar
  ```

*** ** * ** ***

Interface for text-related toolbar.

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/TextToolbar#hide()()` Hide the floating toolbar(post-M) or primary toolbar(pre-M). | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/TextToolbar#showMenu(androidx.compose.ui.geometry.Rect,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Function0)( rect: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect, onCopyRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onPasteRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onCutRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onSelectAllRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? )` Show the floating toolbar(post-M) or primary toolbar(pre-M) for copying, cutting and pasting text. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/TextToolbar#showMenu(androidx.compose.ui.geometry.Rect,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Function0)( rect: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect, onCopyRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onPasteRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onCutRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onSelectAllRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onAutofillRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? )` Show the floating toolbar(post-M) or primary toolbar(pre-M) for copying, cutting and pasting text. | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/TextToolbarStatus` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/TextToolbar#status()` Return the `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/TextToolbarStatus` to check if the toolbar is shown or hidden. | Cmn |

## Public functions

### hide

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

```
fun hide(): Unit
```

Hide the floating toolbar(post-M) or primary toolbar(pre-M).

### showMenu

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

```
fun showMenu(
    rect: Rect,
    onCopyRequested: (() -> Unit)? = null,
    onPasteRequested: (() -> Unit)? = null,
    onCutRequested: (() -> Unit)? = null,
    onSelectAllRequested: (() -> Unit)? = null
): Unit
```

Show the floating toolbar(post-M) or primary toolbar(pre-M) for copying, cutting and pasting text.

| Parameters |
|---|---|
| `rect: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect` | region of interest. The selected region around which the floating toolbar should show. This rect is in global coordinates system. |
| `onCopyRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback to copy text into ClipBoardManager. If null, the copy option will not be shown. |
| `onPasteRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback to get text from ClipBoardManager and paste it. If null, the paste option will not be shown. |
| `onCutRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback to cut text and copy the text into ClipBoardManager. If null, the cut option will not be shown. |
| `onSelectAllRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback to select all the text content. If null, the select all option will not be shown. |

### showMenu

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

```
open fun showMenu(
    rect: Rect,
    onCopyRequested: (() -> Unit)? = null,
    onPasteRequested: (() -> Unit)? = null,
    onCutRequested: (() -> Unit)? = null,
    onSelectAllRequested: (() -> Unit)? = null,
    onAutofillRequested: (() -> Unit)? = null
): Unit
```

Show the floating toolbar(post-M) or primary toolbar(pre-M) for copying, cutting and pasting text.

| Parameters |
|---|---|
| `rect: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect` | region of interest. The selected region around which the floating toolbar should show. This rect is in global coordinates system. |
| `onCopyRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback to copy text into ClipBoardManager. If null, the copy option will not be shown. |
| `onPasteRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback to get text from ClipBoardManager and paste it. If null, the paste option will not be shown. |
| `onCutRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback to cut text and copy the text into ClipBoardManager. If null, the cut option will not be shown. |
| `onSelectAllRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback to select all the text content. If null, the select all option will not be shown. |
| `onAutofillRequested: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback to autofill the field. If null, the autofill option will not be shown. |

## Public properties

### status

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

```
val status: TextToolbarStatus
```

Return the `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/TextToolbarStatus` to check if the toolbar is shown or hidden.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/TextToolbarStatus` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/TextToolbarStatus` of `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/TextToolbar`. |