Skip to main content

A Streamlit custom component for selecting and reordering multiple string values.

Project description

streamlit-sortable-multiselect

A Streamlit custom component for searching, selecting, and reordering multiple string values.

Install

python -m pip install streamlit-sortable-multiselect

For local development:

python -m pip install -e ".[dev]"

For frontend development:

cd streamlit_sortable_multiselect/frontend
npm install
npm run dev

Usage

import streamlit as st
from streamlit_sortable_multiselect import sortable_multiselect

selected = sortable_multiselect(
    "Favorite frameworks",
    options=[
        {"label": "Streamlit", "value": "streamlit", "icon_url": "https://streamlit.io/images/brand/streamlit-mark-color.png"},
        {"label": "FastAPI", "value": "fastapi", "icon_url": "https://fastapi.tiangolo.com/img/favicon.png"},
        {"label": "Django", "value": "django"},
        {"label": "Flask", "value": "flask"},
    ],
    default=["streamlit"],
    placeholder="Search frameworks...",
    show_move_buttons=True,
    show_numbers=True,
    base_color="#eef2ff",
    order_colors={1: "#fee2e2", 2: "#dcfce7"},
    max_selections=3,
    max_selections_placeholder="Choose up to 3 frameworks",
)

st.write(selected)

Build the frontend before packaging or using release mode:

cd streamlit_sortable_multiselect/frontend
npm run build

Run the example app:

streamlit run examples/basic.py

Release

Build and check the distribution files:

cd streamlit_sortable_multiselect/frontend
npm install
npm run build
cd ../..
python -m pip install -e ".[dev]"
python -m build
python -m twine check dist/*

Upload to PyPI with an API token:

python -m twine upload dist/*

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_sortable_multiselect-0.6.0.tar.gz (115.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_sortable_multiselect-0.6.0-py3-none-any.whl (114.1 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_sortable_multiselect-0.6.0.tar.gz.

File metadata

File hashes

Hashes for streamlit_sortable_multiselect-0.6.0.tar.gz
Algorithm Hash digest
SHA256 9afa88d78337c459d1360aed221873197cb7e4895798a7325144dba0d047aa8c
MD5 0a819dc07ee7c661b6913bbd02d9db3c
BLAKE2b-256 341b04e083c6ff751ddbc19fd7dc87f058b7e81eed55eb1886981c9195fecb7b

See more details on using hashes here.

File details

Details for the file streamlit_sortable_multiselect-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_sortable_multiselect-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f2baebd2f3716cd9d950f40a9c5f5e7d6931f301fd6a8e7cba8ae5673973277
MD5 1417f465d73afa4b9d79ddb73c05cb82
BLAKE2b-256 001cf3e873c062411e73d8730b83e05357041f2b35b6f4f3d056069b6f929799

See more details on using hashes here.

Supported by

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