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
docs: form-api-docs updated and removed some old docs (#433)
* docs: form-api-docs updated and removed some old docs
* chore: updated docs removed mentioning the types and tried to explain what they do instead
---------
Co-authored-by: Corbin Crutchley <git@crutchcorn.dev>
Copy file name to clipboardExpand all lines: docs/reference/formApi.md
+59-39Lines changed: 59 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ title: Form API
5
5
6
6
### Creating a new FormApi Instance
7
7
8
-
> Some of these docs may be inaccurate due to an API shift in `0.11.0`. If you're interested in helping us fix these issues, please [join our Discord](https://tlinz.com/discord) and reach out in the `#form` channel.
8
+
9
9
10
10
Normally, you will not need to create a new `FormApi` instance directly. Instead, you will use a framework hook/function like `useForm` or `createForm` to create a new instance for you that utilizes your frameworks reactivity model. However, if you need to create a new instance manually, you can do so by calling the `new FormApi` constructor.
11
11
@@ -20,60 +20,91 @@ An object representing the options for a form.
20
20
-```tsx
21
21
defaultValues?:TData
22
22
```
23
-
-The default values for the form fields.
23
+
-Set initial values for you form.
24
24
-```tsx
25
25
defaultState?:Partial<FormState<TData>>
26
26
```
27
27
- The default state for the form.
28
+
29
+
-```tsx
30
+
asyncDebounceMs?:number
31
+
```
32
+
- Optional time in milliseconds if you want to introduce a delay before firing off an async action.
- A function to be called when the form is submitted and valid.
45
+
- The default time in milliseconds that if set to a number larger than 0, will debounce the async validation event by this length of time in milliseconds.
- A function for custom validation logic for the form.
55
+
- Optional onChange asynchronous counterpart to onChange. Useful for more complex validation logic that might involve server requests.
56
+
40
57
-```tsx
41
-
defaultValidatePristine?:boolean
58
+
onChangeAsyncDebounceMs?:number
42
59
```
43
-
- A boolean flag to enable or disable validation for pristine fields.
60
+
- The default time in milliseconds that if set to a number larger than 0, will debounce the async validation event by this length of time in milliseconds.
- The default minimum cause for a field to be asynchronously validated
70
+
- Optional onBlur asynchronous validation method for when a field loses focus return a `ValidationError` or a promise of `Promise<ValidationError>`
71
+
52
72
-```tsx
53
-
defaultValidateAsyncDebounceMs?:number
73
+
onBlurAsyncDebounceMs?:number
54
74
```
55
75
- The default time in milliseconds that if set to a number larger than 0, will debounce the async validation event by this length of time in milliseconds.
0 commit comments