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",
    empty_message="No frameworks selected",
)

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.1.tar.gz (115.2 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.1-py3-none-any.whl (114.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for streamlit_sortable_multiselect-0.6.1.tar.gz
Algorithm Hash digest
SHA256 cc0fd9f5af0d3c7124e20bf4b8da30c2f7ddd42abfa21964fe1554fc32ab1d8f
MD5 d0dd90dde0db539aae99359491419f81
BLAKE2b-256 f6230390d7c834358a97a5ae7a8cb56bfa01324194f6179a61e1b333c00fcd96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streamlit_sortable_multiselect-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 422117605fb8887a93d8446369c62bf5d6e36507f7ea7063502631513f329bd1
MD5 2390073cc7255083cbce9a8e1de2701e
BLAKE2b-256 d2080255f3fa06341108b9d4418407ee9651924cab40394e78a0235351e22a77

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