---
title: "UndoState"
description: "Defines an interactable undo history."
type: "class"
---

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


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

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


```kotlin
class UndoState internal constructor(private val state: TextFieldState)
```


Defines an interactable undo history.


## Properties

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


```kotlin
val canUndo: Boolean
```


Whether it is possible to execute a meaningful undo action right now. If this value is false,
calling `undo` would be a no-op.



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


```kotlin
val canRedo: Boolean
```


Whether it is possible to execute a meaningful redo action right now. If this value is false,
calling `redo` would be a no-op.



## Functions

```kotlin
fun undo()
```


Reverts the latest edit action or a group of actions that are merged together. Calling it
repeatedly can continue undoing the previous actions.


```kotlin
fun redo()
```


Re-applies a change that was previously reverted via `undo`.


```kotlin
fun clearHistory()
```


Clears all undo and redo history up to this point.



