> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/gradio-app/gradio/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Data

Event data classes provide additional information about events that triggered a listener. When added as a type hint to an event listener function parameter, the corresponding EventData object will automatically be passed.

## EventData

```python theme={null}
gr.EventData
```

The base event data class. Contains information about the event that triggered the listener.

### Attributes

<ResponseField name="target" type="Block | None">
  The component object that triggered the event. Can be used to distinguish multiple components bound to the same listener.
</ResponseField>

### Example

```python theme={null}
import gradio as gr

with gr.Blocks() as demo:
    table = gr.Dataframe([[1, 2, 3], [4, 5, 6]])
    gallery = gr.Gallery([("cat.jpg", "Cat"), ("dog.jpg", "Dog")])
    textbox = gr.Textbox("Hello World!")
    statement = gr.Textbox()
    
    def on_select(value, evt: gr.EventData):
        return f"The {evt.target} component was selected, and its value was {value}."
    
    table.select(on_select, table, statement)
    gallery.select(on_select, gallery, statement)
    textbox.select(on_select, textbox, statement)

demo.launch()
```

## SelectData

```python theme={null}
gr.SelectData
```

Carries information about the `.select()` event.

### Attributes

<ResponseField name="target" type="Block | None">
  The component object that triggered the event.
</ResponseField>

<ResponseField name="index" type="Any">
  The index of the selected item. Is a tuple if the component is two dimensional or selection is a range.
</ResponseField>

<ResponseField name="value" type="Any">
  The value of the selected item.
</ResponseField>

<ResponseField name="row_value" type="Any">
  The value of the entire row that the selected item belongs to, as a 1-D list. Only implemented for the Dataframe component, returns None for other components.
</ResponseField>

<ResponseField name="col_value" type="Any">
  The value of the entire column that the selected item belongs to, as a 1-D list. Only implemented for the Dataframe component, returns None for other components.
</ResponseField>

<ResponseField name="selected" type="bool">
  True if the item was selected, False if deselected.
</ResponseField>

### Example

```python theme={null}
import gradio as gr

with gr.Blocks() as demo:
    table = gr.Dataframe([[1, 2, 3], [4, 5, 6]])
    statement = gr.Textbox()
    
    def on_select(evt: gr.SelectData):
        return f"You selected {evt.value} at {evt.index} from {evt.target}"
    
    table.select(on_select, table, statement)

demo.launch()
```

## LikeData

```python theme={null}
gr.LikeData
```

Carries information about the `.like()` event.

### Attributes

<ResponseField name="target" type="Block | None">
  The component object that triggered the event.
</ResponseField>

<ResponseField name="index" type="int | tuple[int, int]">
  The index of the liked/disliked item. Is a tuple if the component is two dimensional.
</ResponseField>

<ResponseField name="value" type="Any">
  The value of the liked/disliked item.
</ResponseField>

<ResponseField name="liked" type="bool | str">
  True if the item was liked, False if disliked, or string value if any other feedback.
</ResponseField>

### Example

```python theme={null}
import gradio as gr

def test(value, like_data: gr.LikeData):
    return {
        "chatbot_value": value,
        "liked_message": like_data.value,
        "liked_index": like_data.index,
        "liked_or_disliked": like_data.liked
    }

with gr.Blocks() as demo:
    c = gr.Chatbot([("abc", "def")])
    t = gr.JSON()
    c.like(test, c, t)

demo.launch()
```

## KeyUpData

```python theme={null}
gr.KeyUpData
```

Carries information about the `.key_up()` event.

### Attributes

<ResponseField name="target" type="Block | None">
  The component object that triggered the event.
</ResponseField>

<ResponseField name="key" type="str">
  The key that was pressed.
</ResponseField>

<ResponseField name="input_value" type="str">
  The displayed value in the input textbox after the key was pressed. This may be different than the value attribute of the component itself.
</ResponseField>

## DeletedFileData

```python theme={null}
gr.DeletedFileData
```

Carries information about the `.delete()` event.

### Attributes

<ResponseField name="target" type="Block | None">
  The component object that triggered the event.
</ResponseField>

<ResponseField name="file" type="FileData">
  The file that was deleted, as a FileData object.
</ResponseField>

## RetryData

```python theme={null}
gr.RetryData
```

Carries information about the `.retry()` event.

### Attributes

<ResponseField name="target" type="Block | None">
  The component object that triggered the event.
</ResponseField>

<ResponseField name="index" type="int | tuple[int, int]">
  The index of the user message that should be retried.
</ResponseField>

<ResponseField name="value" type="Any">
  The value of the user message that should be retried.
</ResponseField>

## UndoData

```python theme={null}
gr.UndoData
```

Carries information about the `.undo()` event.

### Attributes

<ResponseField name="target" type="Block | None">
  The component object that triggered the event.
</ResponseField>

<ResponseField name="index" type="int | tuple[int, int]">
  The index of the user message that should be undone.
</ResponseField>

<ResponseField name="value" type="Any">
  The value of the user message that should be undone.
</ResponseField>

## EditData

```python theme={null}
gr.EditData
```

Carries information about the `.edit()` event.

### Attributes

<ResponseField name="target" type="Block | None">
  The component object that triggered the event.
</ResponseField>

<ResponseField name="index" type="int | tuple[int, int]">
  The index of the message that was edited.
</ResponseField>

<ResponseField name="previous_value" type="Any">
  The previous content of the message that was edited.
</ResponseField>

<ResponseField name="value" type="Any">
  The new content of the message that was edited.
</ResponseField>

## DownloadData

```python theme={null}
gr.DownloadData
```

Carries information about the `.download()` event.

### Attributes

<ResponseField name="target" type="Block | None">
  The component object that triggered the event.
</ResponseField>

<ResponseField name="file" type="FileData">
  The file that was downloaded, as a FileData object.
</ResponseField>

## CopyData

```python theme={null}
gr.CopyData
```

Carries information about the `.copy()` event.

### Attributes

<ResponseField name="target" type="Block | None">
  The component object that triggered the event.
</ResponseField>

<ResponseField name="value" type="Any">
  The value that was copied.
</ResponseField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.