You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Added form types and their descriptions
I was looking for a complete list of form types and couldn't find any anywhere.
I went through the source code and extracted these with adding some description to them, either using MDN's description or some other website explanation.
* Apply suggestions from code review
Co-authored-by: swyx <[email protected]>
Copy file name to clipboardExpand all lines: docs/basic/getting-started/forms-and-events.md
+39
Original file line number
Diff line number
Diff line change
@@ -98,3 +98,42 @@ If you don't quite care about the type of the event, you can just use React.Synt
98
98
[View in the TypeScript Playground](https://www.typescriptlang.org/play/?jsx=2#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wFgAoCtCAOwGctoRlM4BeRYmAOgFc6kLABQBKClVoM4AMSbs4o9gD4FFOHAA8mJmrhFMbAN7aozJJgC+u2gGVeAIxDAYRoUgBcndDxsBPGjAAFkgwwGgAogBuSAEiynCGuupI3GBE0QEAIuYovAA2MKIA3Elw1PTwMChQAOYh8ilVtfUodHAwvmBIEKyN1XXwAGQJpckgKMB5noZwkSh5vB5wDFDANDVwFiXk6rtwYK10AO7QACbTs-OLnitrG1ulDzu75VJI45PyTQPc7xN53DmCyQRTgAHowe1Okg0ME0ABrOgAQlKr3gBzoxzOX36IVShxOUFOgKuIPBkI6XVhMMRKOe6ghcBCaG4rN0Fis5CUug0p2AkW59M0eRQ9iQeUFe3U4Q+U1GmjWYF4lWhbAARH9Jmq4DQUCAkOrNXltWDJbsNGCRWKJTywXyBTz7Wb1BoreLnbsAAoEs7ueUaRXKqFddUYrFE7W6-Whn0R8Eei1um3PC1Ox38hOBlUhtV0BxOGDaoGLdUAGQgGzWJrNqYzFAtJhAgpEQA)
99
99
100
100
Of course, if you're making any sort of significant form, [you should use Formik](https://jaredpalmer.com/formik) or [React Hook Form](https://react-hook-form.com/), which are written in TypeScript.
| ChangeEvent | Changing the value of `<input>`, `<select>` and `<textarea>` element. |
109
+
| ClipboardEvent | Using copy, paste and cut events. |
110
+
| CompositionEvent | Events that occur due to the user indirectly entering text (e.g. depending on Browser and PC setup, a popup window may appear with additional characters if you e.g. want to type Japanese on a US Keyboard) |
111
+
| DragEvent | Drag and drop interaction with a pointer device (e.g. mouse). |
112
+
| FocusEvent | Event that occurs when elements gets or loses focus. |
113
+
| FormEvent | Event that occurs whenever a form or form element gets/loses focus, a form element value is changed or the form is submitted. |
114
+
| InvalidEvent | Fired when validity restrictions of an input fails (e.g `<input type="number" max="10">` and someone would insert number 20). |
115
+
| KeyboardEvent | User interaction with the keyboard. Each event describes a single key interaction. |
116
+
| MouseEvent | Events that occur due to the user interacting with a pointing device (e.g. mouse) |
117
+
| PointerEvent | Events that occur due to user interaction with a variety pointing of devices such as mouse, pen/stylus, a touchscreen and which also supports multi-touch. Unless you develop for older browsers (IE10 or Safari 12), pointer events are recommended. Extends UIEvent. |
118
+
| TouchEvent | Events that occur due to the user interacting with a touch device. Extends UIEvent. |
| UIEvent | Base Event for Mouse, Touch and Pointer events. |
121
+
| WheelEvent | Scrolling on a mouse wheel or similar input device. (Note: `wheel` event should not be confused with the `scroll` event) |
122
+
| SyntheticEvent | The base event for all above events. Should be used when unsure about event type |
123
+
124
+
<details>
125
+
<summary>
126
+
127
+
**What about `InputEvent`?**
128
+
129
+
</summary>
130
+
131
+
You've probably noticed that there is no `InputEvent`. This is because it is not supported by Typescript as the event itself has no fully browser support and may behave differently in different browsers. You can use `KeyboardEvent` instead.
0 commit comments