## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://dev.writer.com/llms.txt)

Use this file to discover all available pages before exploring further.

A component to display Pandas DataFrames.

## Fields

| Name                    | Type      | Description                                                                                   | Options  |
|-------------------------|-----------|-----------------------------------------------------------------------------------------------|----------|
| Data                    | Text      | Must be a state reference to a Pandas dataframe or PyArrow table. Alternatively, a URL for an Arrow IPC file. | -        |
| Show index              | Boolean   | Shows the dataframe’s index. If an Arrow table is used, shows the zero-based integer index. | -        |
| Enable search           | Boolean   | -                                                                                             | -        |
| Enable adding a record  | Boolean   | -                                                                                             | -        |
| Enable updating a record| Boolean   | -                                                                                             | -        |
| Enable download         | Boolean   | Allows the user to download the data as CSV.                                                | -        |
| Actions                 | Key-Value | Define rows actions                                                                          | -        |
| Enable markdown         | Boolean   | If active, the output will be sanitized; unsafe elements will be removed.                    | -        |
| Display row count       | Number    | Specifies how many rows to show simultaneously.                                              | -        |
| Wrap text               | Boolean   | Not wrapping text allows for an uniform grid, but may be inconvenient if your data contains longer text fields. | -        |
| Primary text            | Color     | -                                                                                             | -        |
| Secondary text          | Color     | -                                                                                             | -        |
| Accent                  | Color     | -                                                                                             | -        |
| Separator               | Color     | -                                                                                             | -        |
| Background              | Color     | -                                                                                             | -        |
| Font style              | Text      | -                                                                                             | 1. normal<br>2. monospace |
| Custom CSS classes      | Text      | CSS classes, separated by spaces. You can define classes in custom stylesheets.              | -        |

## Events

### wf-dataframe-add

Capture adding a row.

```python
# Subscribe this event handler to the `wf-dataframe-add` event
#
# more on : https://dev.writer.com/framework/dataframe
def on_record_add(state, payload):
    payload['record']['sales'] = 0 # default value inside the dataframe
    state['mydf'].record_add(payload) # should contain an EditableDataFrame instance
```

### wf-dataframe-update

Capture a cell change.

```python
# Subscribe this event handler to the `wf-dataframe-update` event
#
# more on : https://dev.writer.com/framework/dataframe
def on_record_change(state, payload):
    state['mydf'].record_update(payload) # should contain an EditableDataFrame instance
```

### wf-dataframe-action

Remove or open a row.

```python
# Subscribe this event handler to the `wf-dataframe-action` event
#
# more on : https://dev.writer.com/framework/dataframe
def on_record_action(state, payload):
    # state['mydf'] should contain an EditableDataFrame instance
    record_index = payload['record_index']
    if payload['action'] == 'remove':
        state['mydf'].record_remove(payload) # should contain an EditableDataFrame instance
    if payload['action'] == 'open':
        state['record'] = state['mydf'].record(record_index) # dict representation of record
```
