Skip to content

Add support for enter key/submit in Input component #2831

Discussion options

You must be logged in to vote

Hi @pranshuchittora

We rely heavily on native web platform conventions. As such, the things you are trying to achieve can be done as if you were just using HTML on its own.

To respond to an enter key press inside a form control, you should use some of the keyPress or keyDown events that are support by the HTML Input element.

To respond to a form submission, you should use a form element to wrap your form, and respond to the onSubmit form event.

I've created a Codesandbox to demonstrate how this works

https://codesandbox.io/s/form-events-and-submission-example-e33kbf

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SiTaggart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants