Collapsible Forms

Hello,

Is there a way to create forms that are collapsible? The following seems to work, but it creates a box within a box. I was hoping it could be just one box?

I even tried form.beta_expander() but that looks the same, and also results in errors when the form is collapsed.

import streamlit as st

with st.beta_expander("Form"):
    form = st.form("Form")
    val1 = form.slider("Value 1", 0, 10)
    val2 = form.slider("Value 2", 10, 20)

    submitted = form.form_submit_button("Submit")

val3 = st.slider("Value 3", 20, 30)

st.write(val1, val2, val3)

1 Like