Is there a double-sided slider?

I’d like to request the addition of a double-sided slider. Currently, the st.slider widget accepts min and max values for the possible range, but the selection bar always goes up to the value the user selects. I’d like the user to be able to adjust the bottom of the slider as well.

For example, if the slider is defined with min=0 and max=100, the user would be able to adjust it to select the range 33-78.

I could do this with two st.slider widgets, one assigned to user_selected_min and the other to user_selected_max, but it would be cleaner and take up less screen space and code to have it all combined into one. Thank you!

1 Like

Hi @eschares, welcome to the community!

The range slider you are looking for is already provided by the widget st.slider.

value ( a supported type or a tuple/list of supported types or None ) – The value of the slider when it first renders. If a tuple/list of two values is passed here, then a range slider with those lower and upper bounds is rendered. For example, if set to (1, 10) the slider will have a selectable range between 1 and 10. Defaults to min_value.

And here’s an example of a range slider:

>>> values = st.slider(
...     'Select a range of values',
...     0.0, 100.0, (25.0, 75.0))
>>> st.write('Values:', values)
1 Like

Excellent, thank you!