Can you use buttons inside of expanders?

I’d like to put a button inside of an expander. Is this possible? The code below writes “Test” inside the expander but the button is drawn outside of it.

with st.sidebar.beta_expander(“Adjust settings”):


if st.sidebar.button("Reset Draft"):

    results_df = results_df[df.round == 0]


You can do that by assigning the beta_expander to a variable and then call the button from that:

expander =  st.sidebar.beta_expander("Adjust settings")
if expander.button("Reset Draft"):
    st.write('Draft resetted')

That’s perfect, thank you!