Create a form that batches elements together with a "Submit" button.
Function signature

st.form(key: str, clear_on_submit: bool = False)


key (str)

A string that identifies the form. Each form must have its own key. (This key is not displayed to the user in the interface.)

clear_on_submit (bool)

If True, all widgets inside the form will be reset to their default values after the user presses the Submit button. Defaults to False. (Note that Custom Components are unaffected by this flag, and will not be reset to their defaults on form submission.)

Was this page helpful?


Still have questions?

Our forums are full of helpful information and Streamlit experts.