Nested expanders

If you’re creating a debugging post, please include the following info:

  1. Are you running your app locally or is it deployed? deployed
  2. If your app is deployed:
    a. Is it deployed on Community Cloud or another hosting platform?internal company portal
    b. Share the link to the public deployed app.
  3. Share the link to your app’s public GitHub repository (including a requirements file).
  4. Share the full text of the error message (not a screenshot).
  5. Share the Streamlit and Python versions. python 3.12, Streamlit, version 1.39.0

I am trying to create nested expanders but get error “Expanders may not be nested inside other expanders.” But in another application it works

    col1, col2 = st.columns(2)  
    groups = ['STORAGE-SUPPORT-TR','FLS-NETWORKS-TR','NETWORK-SUPPORT-TR','NETWORK-CHANGE-TR', 'NETWORK-CHANGE-TECHM', 'CISCO-ACI-CHANGE-APPROVERS']
    with col2.expander(f"** changes listed in last 24 hours in time**",expanded=False):
        for group in groups:
            with st.container():
                with st.expander(f"**Relationship Name : {group}**",expanded=False, icon="🔥"):
                    st.markdown(f"<div class='custom-text'><strong>Number:</strong> {group}</div>", unsafe_allow_html=True)

Hey,
it’s not working for me neither.
Maybe you can workaround with a popover ?

        col1, col2 = st.columns(2)
        groups = ['STORAGE-SUPPORT-TR', 'FLS-NETWORKS-TR', 'NETWORK-SUPPORT-TR', 'NETWORK-CHANGE-TR',
                  'NETWORK-CHANGE-TECHM', 'CISCO-ACI-CHANGE-APPROVERS']
        with st.expander(f"** changes listed in last 24 hours in time**", expanded=False):
            for group in groups:
                with st.container():
                    with st.popover(f"**Relationship Name : {group}**", icon="🔥"):
                        st.markdown(f"<div class='custom-text'><strong>Number:</strong> {group}</div>",
                                    unsafe_allow_html=True)

Thankyou @Faltawer for taking time to check it out. I found an option to make it work by importing streamlit_nested_layout.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.