Skip to main content

A Streamlit component to provide sortable list.

Project description

Streamlit Sortables

A Streamlit component to provide sortable list. You can sort the list of strings on the UI as follows.

https://user-images.githubusercontent.com/329750/163662202-ce292fc4-2882-46ac-8c2c-ca4b9df675d2.mp4

Instllation

$ pip install streamlit-sortables

Usage

Call soretd_items method with a list of string. Return value is the sorted items.

import streamlit as st
from streamlit_sortables import sort_items


original_items = ['A', 'B', 'C']
sorted_items = sort_items(original_items)

st.write(f'original_items: {original_items}')
st.write(f'sorted_items: {sorted_items}')

You can pass list of dicts with multi_containers=True.

import streamlit as st
from streamlit_sortables import sort_items

original_items = [
    {'header': 'first container',  'items': ['A', 'B', 'C']},
    {'header': 'second container', 'items': ['D', 'E', 'F']}
]

sorted_items = sort_items(original_items, multiple_contaieners=True)

st.write(f'original_items: {original_items}')
st.write(f'sorted_items: {sorted_items}')

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_sortables-0.2.0.tar.gz (648.9 kB view hashes)

Uploaded Source

Built Distribution

streamlit_sortables-0.2.0-py3-none-any.whl (657.7 kB view hashes)

Uploaded Python 3

Supported by

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