Files
textual/docs/widgets/list_view.md
Will McGugan 2244b1161e api docs (#2240)
* api docs

* more docstrings

* logs

* docs shakeup

* fix notes, added intro to all apis

* Remove defaults to

* add note to events

* note

* use fira code
2023-04-08 15:35:49 +01:00

58 lines
1.1 KiB
Markdown

# ListView
!!! tip "Added in version 0.6.0"
Displays a vertical list of `ListItem`s which can be highlighted and selected.
Supports keyboard navigation.
- [x] Focusable
- [x] Container
## Example
The example below shows an app with a simple `ListView`.
=== "Output"
```{.textual path="docs/examples/widgets/list_view.py"}
```
=== "list_view.py"
```python
--8<-- "docs/examples/widgets/list_view.py"
```
=== "list_view.css"
```sass
--8<-- "docs/examples/widgets/list_view.css"
```
## Reactive Attributes
| Name | Type | Default | Description |
| ------- | ----- | ------- | ------------------------------- |
| `index` | `int` | `0` | The currently highlighted index |
## Messages
- [ListView.Highlighted][textual.widgets.ListView.Highlighted]
- [ListView.Selected][textual.widgets.ListView.Selected]
## Bindings
The list view widget defines the following bindings:
::: textual.widgets.ListView.BINDINGS
options:
show_root_heading: false
show_root_toc_entry: false
---
::: textual.widgets.ListView
options:
heading_level: 2