Submit button on Enter key press

I need extra functionality in my app, whenever user hits enter key on keyboard, the submit button functionality should run (Which now runs when user clicks with a mouse). Any help is appreciated. Thanks.

Hi @deepanshu_dey ,

Welcome to the Streamlit community forum :partying_face: :balloon:

A use case would have been ideal to understand the issue.
However, if you need your app to run on press of Enter key, you can use st.text_input widget.

Does this help ?

*Best , *
Avra

I have a button inside a form.

with st.form(‘user_form’, clear_on_submit = True):
msg = st.text_area("Message: ", value = “”)
submit_button = st.form_submit_button(label=“Send”)

This button functionality is written in this way:

if submit_button:
Code functionality

Problem is whenever I will hit enter key, submit_button should run…