Files
textual/docs/widgets/list_view.md
Rodrigo Girão Serrão d787f61090 State version of widget addition in docs. (#2144)
* State version of widget addition in docs.

Related issues: #2133

* Fix ListX version info.

* Retroactively update changelog.
2023-03-27 22:32:18 +01:00

1.1 KiB

ListView

!!! tip "Added in version 0.6.0"

Displays a vertical list of ListItems which can be highlighted and selected. Supports keyboard navigation.

  • Focusable
  • 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

::: textual.widgets.ListView.Highlighted

::: 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

See Also