Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mitosch/textual-select
A simple drop-down (select) for textual with an optional search functionality
https://github.com/mitosch/textual-select
Last synced: 3 months ago
JSON representation
A simple drop-down (select) for textual with an optional search functionality
- Host: GitHub
- URL: https://github.com/mitosch/textual-select
- Owner: mitosch
- License: mit
- Created: 2022-12-16T09:32:29.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-12T13:23:37.000Z (over 1 year ago)
- Last Synced: 2024-08-27T09:09:13.454Z (6 months ago)
- Language: Python
- Size: 163 KB
- Stars: 40
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-textualize-projects - Select - A simple drop-down (select) for Textual with an optional search functionality. (Community / Third Party Applications)
README
# Textual: Select
IMPORTANT: Since version 0.24.0 Textual implemented a native dropdown. I strongly
recommend to use the native version. This repository will slowly die. More information
at the [Blog Post about Select control](https://textual.textualize.io/blog/2023/05/08/textual-0240-adds-a-select-control/).A simple select widget (aka dropdown) for [textual](https://github.com/Textualize/textual) with an optional search field.
![select_focus](https://user-images.githubusercontent.com/922559/209305346-6b8971b1-7a3a-4424-bdf8-c439b9d74e28.png)
![select_open](https://user-images.githubusercontent.com/922559/209305349-84f39432-b1e4-405e-8854-a8d7a33230ae.png)
![select_search](https://user-images.githubusercontent.com/922559/209305352-9ad2e7c1-9dc6-435f-b1bd-8dba5f5b2642.png)
## Usage
```python
from textual_select import Selectdropdown_data = [
{"value": 0, "text": "Pick-Up"},
{"value": 1, "text": "SUV"},
{"value": 2, "text": "Hatchback"},
{"value": 3, "text": "Crossover"},
{"value": 4, "text": "Convertible"},
{"value": 5, "text": "Sedan"},
{"value": 6, "text": "Sports Car"},
{"value": 7, "text": "Coupe"},
{"value": 8, "text": "Minivan"}
]Select(
placeholder="please select",
items=dropdown_data,
list_mount="#main_container"
)
```## Installation
```bash
pip install textual-select
```Requires textual 0.11.0 or later.
## Limitations
This textual widget is in early stage and has some limitations:
* It needs a specific mount point (`list_mount`) where the dropdown list
shall appear. This is needed because the container widget with the select
itself could be too small. Maybe in future versions this will no longer
needed.
* It can only open below, not above: Make sure to reserve space below the
dropdown.
* The dropdown list has a fixed height of 5 entries. This will be configurable
in future versions.## Similar Widgets
* If you are looking for an autocomplete, please refer to
[textual-autocomplete](https://github.com/darrenburns/textual-autocomplete)
by Darren Burns.