Can you vary the step size or display a customized scale in slider function?

Hi, I have a question about customizing the slider function and would appreciate any help.

Let’s say I want to make a slider that has the options [1 day, 1 week, 1 month, half a year, 1 year]. I can get something to work using the following code:

import streamlit as st
inputTime = st.slider(‘some prompt’,max_value=4)
sliderOptions = [‘1 day’, ‘1 week’, ‘1 month’, ‘half a year’, ‘1 year’]

This displays the options as the user drags the slider, but the number and the scale displayed on the slider itself are from 0 to 4, is there anyway to customize that?

Thanks in advance!


have a look here:

Especially the last two answers maybe help you at least to find a hack that serves your needs.


Thanks Alex!