Hi Streamlit Community,
I’m working on a Streamlit app where I have a container with scrollable text and buttons. The issue I’m facing is that after pressing a button, the container jumps back to the top, and I lose the scroll position.
Here’s a simplified version of my code:
import streamlit as st
# Container for scrollable text and buttons
with st.container(border=True, height=400):
for i in range(30):
st.write(f"Line {i}")
if st.button("Reload"): #scroll down to button
st.rerun()
# Now I loose the scroll position
I would like to preserve the scroll position inside the container even after a button press. Is there a way to achieve this in Streamlit?
Any help or suggestions would be greatly appreciated!
Thanks in advance!