Is it possible to re-fold nested content in st.button once button's been pressed/content has been unfolded?

I’m referring to this:

https://docs.streamlit.io/en/stable/api.html?highlight=st.button#streamlit.button

if st.button('Say hello'):
    st.write('Why hello there')
else:
    st.write('Goodbye')

Once unfolded, we cannot re-fold

Does anyone know a hack/alternative?

Thanks,
Charly

For (un)folding content, I’d rather use checkboxes. Is there a specific reason you’d use buttons instead in your case?

1 Like

Thanks Synode, and yes, that is what I did.
It works fine! :slight_smile:

1 Like