textual-tags


Nametextual-tags JSON
Version 0.3.2 PyPI version JSON
download
home_pageNone
SummaryA custom tags widget to be used in textual applications
upload_time2025-08-09 13:00:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords python tags textual tui uv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- Icons -->
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![PyPI-Server](https://img.shields.io/pypi/v/textual-tags.svg)](https://pypi.org/project/textual-tags/)
[![Pyversions](https://img.shields.io/pypi/pyversions/textual-tags.svg)](https://pypi.python.org/pypi/textual-tags)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://static.pepy.tech/badge/textual-tags)](https://pepy.tech/project/textual-tags)
[![Coverage Status](https://coveralls.io/repos/github/Zaloog/textual-tags/badge.svg?branch=main)](https://coveralls.io/github/Zaloog/textual-tags?branch=main)

# textual-tags

![demo_image](https://raw.githubusercontent.com/Zaloog/textual-tags/main/images/textual_tags_image.png)

This library provides a custom tags widget called `Tags`,
which can be easily added into your existing [textual] application.

Requires a Nerdfont to render the round corners of the Tag labels.

## Features
- Can be initiated with a predefined set/list of tags, similar entries will be ignored
- Consists of a TagInput, with autocompletion powered by [textual-autocomplete] for existing tags
and displayed tags wrapped in a flexbox-like container
- Two different ways to display the tags (with `x` at the end or without)
- Option to also add new not predefined tags, which are then also available for autocompletion
- vim-like completion control

## Installation
textual-tags is hosted on [PyPi] and can be installed with:

```bash
pip install textual-tags
```

or add it to your project using [uv] with:

```bash
uv add textual-tags
```
## Demo App
You can run the demo app after installation with `textual-tags` or using [uv] with:

```bash
uvx textual-tags
```

## Usage
Here is an exampke usage of the `Tags`-widget in a textual App. You can also check the demo app
[here](https://github.com/Zaloog/textual-tags/blob/main/src/textual_tags/demo.py).

```python
from textual.app import App

from textual_tags import Tags

PRE_DEFINED_TAGS = [
    "uv",
    "Terminal",
    "tcss",
    "Textual",
    "Tags",
    "Widget",
    "Python",
    "TUI",
    "Highlander"
]

class TagsApp(App):
    DEFAULT_CSS = """
    Tags {
        width:50;
    }
    """
    def compose(self):
        yield Tags(
            # list/set of tags to start with
            tag_values=PRE_DEFINED_TAGS,
            # Show Tag-Labels as `TAG x` instead of ' TAG '
            show_x=False,
            # All tags are selected on startup
            start_with_tags_selected=True,
            # Allow to enter custom new tags and dont hide TagInput if all tags are selected
            # Also allows delete/edit of last tag when pressing `backspace` on empty input
            allow_new_tags=False,
        )

def main():
    app = TagsApp()
    app.run()

if __name__ == '__main__':
    main()
```

## Messages
Tags sends two messages:
- `Tag.Removed`, send when a tag is removed in any way
- `Tag.Focused`, send when a tag is focused
- `Tag.Hovered`, send when a tag is hovered
- `Tag.Selected`, send when a tag is selected
- `TagAutoComplete.Applied`, send when a completion option is applied

## Issues/Feedback
Feel free to reach out and share your feedback, or open an [Issue],
if something doesnt work as expected. Also check the [Changelog] for new updates.

<!-- Repo Links -->
[Changelog]: https://github.com/Zaloog/textual-tags/blob/main/CHANGELOG.md
[Issue]: https://github.com/Zaloog/textual-tags/issues


<!-- external Links Python -->
[textual]: https://textual.textualize.io
[pipx]: https://github.com/pypa/pipx
[PyPi]: https://pypi.org/project/textual-tags/
[textual-autocomplete]: https://github.com/darrenburns/textual-autocomplete

<!-- external Links Others -->
[uv]: https://docs.astral.sh/uv

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "textual-tags",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "python, tags, textual, tui, uv",
    "author": null,
    "author_email": "Zaloog <gramslars@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/4c/25/01db2f7bf539c111ee5a67e1e68cb8cedb2e7e30ce0400602e1652680076/textual_tags-0.3.2.tar.gz",
    "platform": null,
    "description": "<!-- Icons -->\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![PyPI-Server](https://img.shields.io/pypi/v/textual-tags.svg)](https://pypi.org/project/textual-tags/)\n[![Pyversions](https://img.shields.io/pypi/pyversions/textual-tags.svg)](https://pypi.python.org/pypi/textual-tags)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Downloads](https://static.pepy.tech/badge/textual-tags)](https://pepy.tech/project/textual-tags)\n[![Coverage Status](https://coveralls.io/repos/github/Zaloog/textual-tags/badge.svg?branch=main)](https://coveralls.io/github/Zaloog/textual-tags?branch=main)\n\n# textual-tags\n\n![demo_image](https://raw.githubusercontent.com/Zaloog/textual-tags/main/images/textual_tags_image.png)\n\nThis library provides a custom tags widget called `Tags`,\nwhich can be easily added into your existing [textual] application.\n\nRequires a Nerdfont to render the round corners of the Tag labels.\n\n## Features\n- Can be initiated with a predefined set/list of tags, similar entries will be ignored\n- Consists of a TagInput, with autocompletion powered by [textual-autocomplete] for existing tags\nand displayed tags wrapped in a flexbox-like container\n- Two different ways to display the tags (with `x` at the end or without)\n- Option to also add new not predefined tags, which are then also available for autocompletion\n- vim-like completion control\n\n## Installation\ntextual-tags is hosted on [PyPi] and can be installed with:\n\n```bash\npip install textual-tags\n```\n\nor add it to your project using [uv] with:\n\n```bash\nuv add textual-tags\n```\n## Demo App\nYou can run the demo app after installation with `textual-tags` or using [uv] with:\n\n```bash\nuvx textual-tags\n```\n\n## Usage\nHere is an exampke usage of the `Tags`-widget in a textual App. You can also check the demo app\n[here](https://github.com/Zaloog/textual-tags/blob/main/src/textual_tags/demo.py).\n\n```python\nfrom textual.app import App\n\nfrom textual_tags import Tags\n\nPRE_DEFINED_TAGS = [\n    \"uv\",\n    \"Terminal\",\n    \"tcss\",\n    \"Textual\",\n    \"Tags\",\n    \"Widget\",\n    \"Python\",\n    \"TUI\",\n    \"Highlander\"\n]\n\nclass TagsApp(App):\n    DEFAULT_CSS = \"\"\"\n    Tags {\n        width:50;\n    }\n    \"\"\"\n    def compose(self):\n        yield Tags(\n            # list/set of tags to start with\n            tag_values=PRE_DEFINED_TAGS,\n            # Show Tag-Labels as `TAG x` instead of ' TAG '\n            show_x=False,\n            # All tags are selected on startup\n            start_with_tags_selected=True,\n            # Allow to enter custom new tags and dont hide TagInput if all tags are selected\n            # Also allows delete/edit of last tag when pressing `backspace` on empty input\n            allow_new_tags=False,\n        )\n\ndef main():\n    app = TagsApp()\n    app.run()\n\nif __name__ == '__main__':\n    main()\n```\n\n## Messages\nTags sends two messages:\n- `Tag.Removed`, send when a tag is removed in any way\n- `Tag.Focused`, send when a tag is focused\n- `Tag.Hovered`, send when a tag is hovered\n- `Tag.Selected`, send when a tag is selected\n- `TagAutoComplete.Applied`, send when a completion option is applied\n\n## Issues/Feedback\nFeel free to reach out and share your feedback, or open an [Issue],\nif something doesnt work as expected. Also check the [Changelog] for new updates.\n\n<!-- Repo Links -->\n[Changelog]: https://github.com/Zaloog/textual-tags/blob/main/CHANGELOG.md\n[Issue]: https://github.com/Zaloog/textual-tags/issues\n\n\n<!-- external Links Python -->\n[textual]: https://textual.textualize.io\n[pipx]: https://github.com/pypa/pipx\n[PyPi]: https://pypi.org/project/textual-tags/\n[textual-autocomplete]: https://github.com/darrenburns/textual-autocomplete\n\n<!-- external Links Others -->\n[uv]: https://docs.astral.sh/uv\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A custom tags widget to be used in textual applications",
    "version": "0.3.2",
    "project_urls": {
        "Changelog": "https://github.com/Zaloog/textual-tags/blob/main/CHANGELOG.md",
        "Repository": "https://github.com/Zaloog/textual-tags"
    },
    "split_keywords": [
        "python",
        " tags",
        " textual",
        " tui",
        " uv"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "58305f55bc7d1e3754653ef430d5ebea45770c19f1a34b251b90da7a54fa1001",
                "md5": "f30397f1a921f9142acfb14653e3cf02",
                "sha256": "be7e78766eb5c9d2756d8bc26e9c5e08b188d9e37ce018945936f07f54e6269e"
            },
            "downloads": -1,
            "filename": "textual_tags-0.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f30397f1a921f9142acfb14653e3cf02",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 10054,
            "upload_time": "2025-08-09T13:00:28",
            "upload_time_iso_8601": "2025-08-09T13:00:28.721171Z",
            "url": "https://files.pythonhosted.org/packages/58/30/5f55bc7d1e3754653ef430d5ebea45770c19f1a34b251b90da7a54fa1001/textual_tags-0.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4c2501db2f7bf539c111ee5a67e1e68cb8cedb2e7e30ce0400602e1652680076",
                "md5": "c7e59543448d175f2ef5e75848adc37c",
                "sha256": "7f0bf8fde09fca91ee2c951aa36c01d1f88b16bd27ce05e8d728278471539c7f"
            },
            "downloads": -1,
            "filename": "textual_tags-0.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c7e59543448d175f2ef5e75848adc37c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 106006,
            "upload_time": "2025-08-09T13:00:29",
            "upload_time_iso_8601": "2025-08-09T13:00:29.735164Z",
            "url": "https://files.pythonhosted.org/packages/4c/25/01db2f7bf539c111ee5a67e1e68cb8cedb2e7e30ce0400602e1652680076/textual_tags-0.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-09 13:00:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Zaloog",
    "github_project": "textual-tags",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "textual-tags"
}
        
Elapsed time: 1.08031s