A slider with a lot more features in it than the built in one.
Project description
streamlit-super-slider
Streamlit Super Slider
Streamlit Super Slider is a custom component for Streamlit that extends the functionality of the default slider. It provides a more interactive and user-friendly experience with additional features to enhance usability.
Features
- Updates Streamlit only on mouse release, not during dragging the mouse.
- Includes an input text box attached to the slider where changing the value in either updates the value in the other (input text changes the slider and vice versa).
- Arrow buttons to increase/decrease the value by one, providing a "next" or "previous" button functionality.
- Built-in keyboard shortcuts for quick navigation: "," (comma) for previous and "." (period) for next.
Installation
You can install the package via pip:
pip install streamlit-super-slider
Arguments
Argument | Type | Description | Default |
---|---|---|---|
min_value |
int | Minimum value for the slider. | 0 |
max_value |
int (optional) | Maximum value for the slider. Must be specified if values is not provided. |
None |
default_value |
int (optional) | The default value to set the slider to. | 0 |
values |
Union[List, Dict[int,str], None] (optional) | By default, the slider will have a range from min_value to max_value . Specify special set of values through a list or dict. |
None |
dots |
bool (optional) | If True, will show dots on the slider for each step. | False |
steps |
int (optional) | Determines the spacing between the dots. | None |
key |
Any (optional) | Streamlit key for the component. | None |
Usage
To use the Streamlit Super Slider in your Streamlit app, you simply need to import it and use the st_slider
function:
import streamlit as st
from streamlit_super_slider import st_slider
st.title("Streamlit Super Slider Example")
min_value = 0
max_value = 100
default_value = 50
# Use the Streamlit Super Slider component
slider_value = st_slider(min_value, max_value, default_value)
st.write("Slider with range")
value = st_slider(values={0: "zero", 10:'10', 25:'25', max_value: "max"}, key="my_slider2" ,dots=False)
st.write("Slider custom values from dictionary and steps")
value = st_slider(values={0: "zero", 10:'10', 20:'30', 90:'90', max_value: "max"}, key="my_slider2_steps" ,dots=False, steps=10)
st.write("Slider custom values from dictionary, steps and dots")
value = st_slider(values={0: "zero", 10:'10', 20:'30', 90:'90', max_value: "max"}, key="my_slider2_dots_steps" ,dots=True, steps=10)
st.write("Slider with custom values from list")
value = st_slider(values=[0,100,350,34560], key="my_slider3")
st.write(f"Selected value: {slider_value}")
Demo
In the following demo you can see usage of the slider to show images, and all the different ways to chose where to go:
- Keyboard shortcut
- Pressing the arrow buttons
- Changing the value in the input text box
- Dragging the slider
Contributing
We welcome contributions to the Streamlit Super Slider project. If you'd like to report bugs, request features, or contribute to the code, please open an issue or submit a pull request on the GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for streamlit-super-slider-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96dd0576227163c2157f3ac32b9023cb382251dd960bed0d0ae8308bcd1f6507 |
|
MD5 | e6bbb9d4e881ffe2465807286d2c2f54 |
|
BLAKE2b-256 | 8b0fd45cb639aebd5654c5d0c8b77efe47b47d2ca08dc63affe2c6c2c7c2e9a9 |
Hashes for streamlit_super_slider-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85bb4748fb0212be1190a9f7805176626932b0a10adab1d345eac3a35868aeae |
|
MD5 | a2781ee2f572be8d5110a5e9adaa995f |
|
BLAKE2b-256 | ee6157c9aad4edaac1ae0c7be0c6ec7c13c96644c3ed500552d36111b6501cbc |