Skip to main content

Tags custom component for Streamlit

Project description

Streamlit-tags

pypi Version conda Version PyPi downloads Conda downloads

A custom component to have Tags in Streamlit.

ezgif com-gif-maker (1)

Please star⭐ the repo and share the usage if you liked it.

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:

  • st_tags to display the tags feature
  • st_tags_sidebar to display the tags in the sidebar

Check the examples/ folder of the project a quick start.

Check out demo here: https://share.streamlit.io/gagan3012/streamlit-tags/examples/app.py

Definition

def st_tags(label: str,
            text: str,
            value: list,
            suggestions: list = [],
            key=None) -> list:
    '''

    :param suggestions: (List) List of possible suggestions
    :param label: (Str) Label of the Function
    :param text: (Str) Instructions for entry
    :param value: (List) Initial Value
    :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: the suggestion field is optional

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

def st_tags_sidebar(label: str,
                    text: str,
                    value: list,
                    suggestions: list = [],
                    key=None) -> list:
    '''

    :param suggestions: (List) List of possible suggestions
    :param label: (Str) Label of the Function
    :param text: (Str) Instructions for entry
    :param value: (List) Initial Value
    :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 field is optional

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'],
                   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'])

Sample Images:

image

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.1.6.tar.gz (559.1 kB view details)

Uploaded Source

Built Distribution

streamlit_tags-1.1.6-py3-none-any.whl (2.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: streamlit_tags-1.1.6.tar.gz
  • Upload date:
  • Size: 559.1 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.1.6.tar.gz
Algorithm Hash digest
SHA256 3e21750d5a58f98057e288c9039c04f239f2da77ac18da9883deab6b286a9195
MD5 4aad63565d4b1d6b1de70ae0c308e70e
BLAKE2b-256 f0f6e968cf4819e827d5c70ee1e4c6fbdcc25dc3172cc42a9e7b87b2ef3a49f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: streamlit_tags-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 2.1 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.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0160fda35c988b650e6a0ce76f1b0056bc7c94856069c5ab2f190bd749e3a8e6
MD5 ffb773a06aa8e97a881616b54c981279
BLAKE2b-256 7388edc75811cf15d8048121ae084d2962db292d3b55eaa911d827aa1232b78a

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