Files
textual/docs/widgets/list_view.md
Dave Pearson aad6d98aa5 More documentation tweaks (#2001)
* Change the title of some widget references to their class names

The widget reference index had a slight mixture of widget title styles, some
being their class name, others being "written English" type titles. This
settles on the titles always being the class name.

* Add a link to the ContentSwitcher to the widget gallery

No screenshot for this, on purpose. By definition this widget isn't visible,
except via other widgets that it's enclosing and handling.

* Have mkdocs watch the main nav file

* Mark the content switcher off the roadmap
2023-03-09 14:01:48 +00:00

1.0 KiB

ListView

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 directly the following bindings:

::: textual.widgets.ListView.BINDINGS options: show_root_heading: false show_root_toc_entry: false

See Also