Coder Social home page Coder Social logo

nathanybx / streamlit-tags Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gagan3012/streamlit-tags

0.0 0.0 0.0 968 KB

Custom Tag component for streamlit

Home Page: https://streamlit-tags.readthedocs.io/en/latest/

License: MIT License

Shell 0.66% Python 24.92% TypeScript 68.39% CSS 2.74% HTML 3.28%

streamlit-tags's Introduction

Streamlit-tags

pypi Version conda Version Downloads Conda downloads Streamlit App Documentation Status

streamlit-tags

A custom component to add Tags in Streamlit.

gif

Please Upgrade to 1.2.7 version

πŸ“’ 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 conda-forge 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='2')

Sample Images of the UI:

UI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.