Skip to main content

Tags custom component for Streamlit

Project description

Streamlit-tags

pypi Version conda Version Downloads Conda downloads

streamlit-tags

A custom component to add Tags in Streamlit.

gif

📢 Favour:

It would be highly motivating, if you can STAR⭐ this repo if you find it helpful.

Try out a demo here: Streamlit App

Check out docs here: https://streamlit-tags.readthedocs.io/en/latest/

Install

PyPi

pip install streamlit-tags

The installation can also be found on PyPi

Anaconda

conda install -c gagan3012 streamlit-tags

The installation can also be found on Anaconda

Usage

This library has two main functions to display and use tags:

Definition

def st_tags(value: list,
            suggestions: list,
            label: str,
            text: str,
            maxtags: int,
            key=None) -> list:
    '''
    :param maxTags: Maximum number of tags allowed maxtags = -1 for unlimited entries
    :param suggestions: (List) List of possible suggestions (optional)
    :param label: (Str) Label of the Function
    :param text: (Str) Instructions for entry
    :param value: (List) Initial Value (optional)
    :param key: (Str)
        An optional string to use as the unique key for the widget.
        Assign a key so the component is not remount every time the script is rerun.
    :return: (List) Tags

    Note: usage also supports keywords = st_tags()
    '''

Note: the suggestion and value fields are optional

Note:

  • The suggestion and value fields are optional
  • Usage also supports keywords = st_tags()
  • Upgrade to 1.1.9 for being able to control number of tags

We also have a function now to embed the tags function to the sidebar:

def st_tags_sidebar(value: list,
                    suggestions: list,
                    label: str,
                    text: str,
                    maxtags: int,
                    key=None) -> list:
    '''
    :param maxTags: Maximum number of tags allowed maxtags = -1 for unlimited entries
    :param suggestions: (List) List of possible suggestions (optional)
    :param label: (Str) Label of the Function
    :param text: (Str) Instructions for entry
    :param value: (List) Initial Value (optional)
    :param key: (Str)
        An optional string to use as the unique key for the widget.
        Assign a key so the component is not remount every time the script is rerun.
    :return: Tags
    '''

Note:

  • The suggestion and value fields are optional
  • Usage also supports keywords = st_tags_sidebar()
  • Upgrade to 1.1.9 for being able to control number of tags

Example Usage

keywords = st_tags(
    label='# Enter Keywords:',
    text='Press enter to add more',
    value=['Zero', 'One', 'Two'],
    suggestions=['five', 'six', 'seven', 
                 'eight', 'nine', 'three', 
                 'eleven', 'ten', 'four'],
    maxtags = 4,
    key='1')

keyword = st_tags_sidebar(
    label='# Enter Keywords:',
    text='Press enter to add more',
    value=['Zero', 'One', 'Two'],
    suggestions=['five', 'six', 'seven', 
                 'eight', 'nine', 'three', 
                 'eleven', 'ten', 'four'],
    maxtags = 4,
    key='1')

Sample Images of the UI:

UI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_tags-1.2.0.tar.gz (560.2 kB view details)

Uploaded Source

Built Distribution

streamlit_tags-1.2.0-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

Details for the file streamlit_tags-1.2.0.tar.gz.

File metadata

  • Download URL: streamlit_tags-1.2.0.tar.gz
  • Upload date:
  • Size: 560.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.9

File hashes

Hashes for streamlit_tags-1.2.0.tar.gz
Algorithm Hash digest
SHA256 518f6816bae07b242e6da8ec2479b0561ef7e023893c4ff0722eb76746113fdf
MD5 4bd610cf904d312b14cd41d5025efdbb
BLAKE2b-256 b0955d3d1506e434f3ece71ff381def9d2c1897c9ca0f478736a8441b27b2f71

See more details on using hashes here.

File details

Details for the file streamlit_tags-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: streamlit_tags-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.9

File hashes

Hashes for streamlit_tags-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c04aca200d266c2ae24b10bb4bfa21d8e6730542c4aad0c7673bd38670f674d
MD5 96d1e393a6e5bf9316023e20ce10c912
BLAKE2b-256 b4dae379aa705eb0bbb2a6dabed36e613a34ac18b990ecada78b4a937c5e042e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page