Can't write within beta_expander when the expander is inside a column from beta_columns?

Hi!

I’ve found that beta_expander works exactly as expected (with its arg ‘expanded’ as False by default):

        # Works great!
        with st.beta_expander('Show more info'):
            st.write('More info!')

But if I try to add an expander within a column from beta_columns(), although the expander appears as expected in the column of the layout, I can’t get content to write to the frame inside the expander:

        # Doesn't work as expected
        col1, col2 = st.beta_columns(2)
        col1.write('More info in column layout?')
        with col2.beta_expander('Show more info in column!'):
            col2.write('More info!')

Here, ‘More info!’ appears below the expander, as if I had just written st.write('More info!')

Am I doing something wrong, or is this behaviour just not supported (yet?)!?

Thanks so much :slight_smile:

1 Like

Hello Paul,

Can you try this:

col1, col2 = st.beta_columns(2)
col1.write('More info in column layout?')
expdr = col2.beta_expander('Show more info in column!')
expdr.write('More info!')