Tags custom component for Streamlit
Project description
Streamlit-tags
A custom component to add Tags in Streamlit.
Please star⭐ the repo and share the usage if you liked it.
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 featurest_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 (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: the suggestion and value fields are 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 (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
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 of the UI:
Project details
Release history Release notifications | RSS feed
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.7.tar.gz
(559.2 kB
view hashes)
Built Distribution
Close
Hashes for streamlit_tags-1.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d73f85656bdcfc7b0285f2e4a2ac14367353c53a87493f5d502d4eca681f59a |
|
MD5 | 20f7b6ef68e2e23c96686edcee7ecf42 |
|
BLAKE2b-256 | 91e4722a956e3fb02f8a9eab725eb36d09935a5a1d2b3eb5ebfd1388145df826 |