---
title: "TextToolbar"
description: "Interface for text-related toolbar."
type: "interface"
---

<div class='type'>Interface</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>



```kotlin
@JvmDefaultWithCompatibility
interface TextToolbar
```


Interface for text-related toolbar.


## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val status: TextToolbarStatus
```


Return the `TextToolbarStatus` to check if the toolbar is shown or hidden.

#### Returns

| | |
| --- | --- |
|  | `TextToolbarStatus` of `TextToolbar`. |




## Functions

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


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

#### Parameters

| | |
| --- | --- |
| rect | region of interest. The selected region around which the floating toolbar should show. This rect is in global coordinates system. |
| onCopyRequested | callback to copy text into ClipBoardManager. If null, the copy option will not be shown. |
| onPasteRequested | callback to get text from ClipBoardManager and paste it. If null, the paste option will not be shown. |
| onCutRequested | callback to cut text and copy the text into ClipBoardManager. If null, the cut option will not be shown. |
| onSelectAllRequested | callback to select all the text content. If null, the select all option will not be shown. |
| onAutofillRequested | callback to autofill the field. If null, the autofill option will not be shown. |



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


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

#### Parameters

| | |
| --- | --- |
| rect | region of interest. The selected region around which the floating toolbar should show. This rect is in global coordinates system. |
| onCopyRequested | callback to copy text into ClipBoardManager. If null, the copy option will not be shown. |
| onPasteRequested | callback to get text from ClipBoardManager and paste it. If null, the paste option will not be shown. |
| onCutRequested | callback to cut text and copy the text into ClipBoardManager. If null, the cut option will not be shown. |
| onSelectAllRequested | callback to select all the text content. If null, the select all option will not be shown. |



```kotlin
fun hide()
```


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



