Skip to main content

Searchable SelectionList

image Project License - MIT

Add search to Textual's SelectionList.

  • Selectable items can be filtered by substring.
  • Select one or multiple items.
  • Search is case-insensitive.
  • Title and description can be customized.

Installation

pip install textual-searchable-selectionlist

Usage

from textual_searchable_selectionlist.options import SelectionStrategy
from textual_searchable_selectionlist.select import select, select_enum

selected = select(
    ['John', 'Jane', 'James'],
    selection_strategy=SelectionStrategy.MULTIPLE,
    search_title='Select people',
)

# Enums
# class Color(Enum):
#     RED = 'red'
#     GREEN = 'green'
#
# selected_colors = select_enum(Color, selection_strategy=SelectionStrategy.ONE)

Events and callbacks

Use selected_callback when embedding the widget, or listen for the SearchableListWidget.Selected message in your app.

from textual.app import App, ComposeResult
from textual_searchable_selectionlist.options import SelectionStrategy
from textual_searchable_selectionlist.searchable_list_widget import SearchableListWidget


class MyApp(App):
    def compose(self) -> ComposeResult:
        yield SearchableListWidget(
            "Alpha",
            "Beta",
            "Gamma",
            selection_strategy=SelectionStrategy.ONE,
            selected_callback=self._on_selected_callback,
        )

    def _on_selected_callback(self, selected: list[str]):
        self.log(f"Callback selected: {selected}")

    def on_searchable_list_widget_selected(
        self, event: SearchableListWidget.Selected
    ):
        self.log(f"Event selected: {event.selected}")

Development and testing

Make sure uv is installed globally.

There are currently no automated tests. Manual testing can be done by running:

python tests/manual/searchable_selection_list_select.py

Release files for textual-searchable-selectionlist 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for textual-searchable-selectionlist 0.0.8
File Size Uploaded
textual_searchable_selectionlist-0.0.8.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for textual-searchable-selectionlist 0.0.8
File Interpreter ABI Platform
textual_searchable_selectionlist-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 20.2 kB

Release files / textual_searchable_selectionlist-0.0.8.tar.gz

Download URL textual_searchable_selectionlist-0.0.8.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6c9e6e2f4e380a8b91f5e43a8d29ddc3089c1ca1e52746f9648af2e1aad5e9dd
BLAKE2b-256 checksum
How to use checksums
fc8ff0a56f8a9fdb3a6a99fc9f18d9822c1eb9ab6e28c6a10d4a0a768dba5130
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / textual_searchable_selectionlist-0.0.8-py3-none-any.whl

Download URL textual_searchable_selectionlist-0.0.8-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05cf9dbd452f3b2c460eeba0f64a3841741736a1f72436460c3281e3ffef989f
BLAKE2b-256 checksum
How to use checksums
ae457e3ac82b07c4cd8d5042added7588804e986d0827fc12226240f5cab0f63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page