Files
textual/docs/widgets/list_view.md
Will McGugan f5e779c4c4 tabbed content widget (#2059)
* tabbed content widget

* TabbedContent widget and docs

* missing docs

* fix active

* doc fix

* test fix

* additional test

* test for render_str

* docstring

* changelog

* doc update

* changelog

* fix bad optimization

* Update docs/widgets/tabbed_content.md

Co-authored-by: Dave Pearson <davep@davep.org>

* fix for empty initial

* docstrings

* Update src/textual/widgets/_content_switcher.py

Co-authored-by: Dave Pearson <davep@davep.org>

* docstring

* remove log

* permit nested tabs

* renamed TabsCleared to Cleared

* added tests, fix types on click

* tests

* fix broken test

* fix for nested tabs

---------

Co-authored-by: Dave Pearson <davep@davep.org>
2023-03-18 10:38:41 +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 the following bindings:

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

See Also