Custom Tag component for streamlit
MIT License
A custom component to add Tags in Streamlit.
It would be highly motivating, if you can STAR⭐ this repo if you find it helpful.
Try out a demo here:
Check out docs here: https://streamlit-tags.readthedocs.io/en/latest/
pip install streamlit-tags
The installation can also be found on PyPi
conda install -c conda-forge streamlit_tags
The installation can also be found on Anaconda
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 sidebarexamples/
folder of the project a quick start.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
keywords = st_tags()
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
'''
keywords = st_tags_sidebar()
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='2')