Scrolling through pills?

Hello,

I am new to Streamlit and have been finding it fantastic! So intuitive to use and perfect for the personal project I am working on. In a few days only I got my dashboard up and running.

In short, I have a number of years (2009 to 2024) that I display using st.pills. The user can only ever select one value. I would like to display a subset of the years and have a “scrolling” mechanism to reveal more values than shown initially. I was hoping someone would know how to do this. I couldn’t quite find a solution in the documentation and forum, or one that worked and I understood…

OPTION 1 – show last values and display arrow to scroll left

← (2015) (2016) (2017) (2018) (2019) (2020) (2021) (2022) (2023) (2024)

A click on “←” would reveal the pills for years < 2015.

OPTION 2 – show middle values and display arrows to scroll left/right

← (2012) (2013) (2014) (2015) (2016) (2017) (2018) (2019) (2020) (2021) →

A click on either arrow would reveal the hidden pills accordingly.

Is this possible?