Files
textual/docs/widgets/data_table.md
2023-01-16 10:50:41 +00:00

42 lines
1.5 KiB
Markdown

# DataTable
A data table widget.
- [x] Focusable
- [ ] Container
## Example
The example below populates a table with CSV data.
=== "Output"
```{.textual path="docs/examples/widgets/data_table.py"}
```
=== "data_table.py"
```python
--8<-- "docs/examples/widgets/data_table.py"
```
## Reactive Attributes
| Name | Type | Default | Description |
|-----------------|---------|---------------|-------------------------------------------------------|
| `show_header` | `bool` | `True` | Show the table header |
| `fixed_rows` | `int` | `0` | Number of fixed rows (rows which do not scroll) |
| `fixed_columns` | `int` | `0` | Number of fixed columns (columns which do not scroll) |
| `zebra_stripes` | `bool` | `False` | Display alternating colors on rows |
| `header_height` | `int` | `1` | Height of header row |
| `show_cursor` | `bool` | `True` | Show the cursor |
| `cursor_type` | `str` | `"cell"` | One of `"cell"`, `"row"`, `"column"`, or `"none"` |
| `cursor_cell` | `Coord` | `Coord(0, 0)` | The cell the cursor is on |
| `hover_cell` | `Coord` | `Coord(0, 0)` | The cell currently hovered over by the mouse cursor |
## See Also
* [DataTable][textual.widgets.DataTable] code reference