- ErrorType
- ErrorsType
- FormInputType
- FormModelType
- IsDirtyType
- IsRequiredType
- ValidatorFuncType
- ValueType
- ValuesType
- HandleOnChangeType
- HandleOnSubmitType
- useFormType
Ƭ Object
Param | Type |
---|---|
hasError | boolean |
message | string |
Defined at index.ts:209
Ƭ Object
▪ [key: string
]: ErrorType
key
: input field name
Defined at index.ts:214
Ƭ Object
Param | Type |
---|---|
required | boolean |
validator? | ValidatorFuncType |
value | ValueType |
?
optional params
Defined at index.ts:189
Ƭ Object
▪ [key: string
]: FormInputType
key
: input field name
Defined at index.ts:185
Ƭ Object
▪ [key: string
]: boolean
key
: input field name
Defined at index.ts:195
Ƭ Object
▪ [key: string
]: boolean
key
: input field name
Defined at index.ts:199
Ƭ (value
: ValueType
, values?
: ValuesType
) => string
Param | Type | Description |
---|---|---|
value | ValueType |
current value of input field |
values? | ValuesType |
values state object to compare for validation |
?
optional params
string
: custom error message returned from the validator function, or an empty string for no error.
Defined at index.ts:183
Ƭ string
Defined at index.ts:203
Ƭ Object
▪ [key: string
]: ValueType
key
: input field name
Defined at index.ts:205
Ƭ (event
: ChangeEvent
<HTMLInputElement
>) => void
Param | Type |
---|---|
event | ChangeEvent <HTMLInputElement > |
!
returns nothing directly to the end user as it manages the controlled form values and _IsDirty states.
Defined at index.ts:180
Ƭ (event
: FormEvent
<HTMLFormElement
>) => void
Param | Type |
---|---|
event | FormEvent <HTMLFormElement > |
!
when the form has been validated, enabled and submitted, this callback function triggers another function set by the
user.
Defined at index.ts:181
Ƭ Object
Param | Type | Description |
---|---|---|
values | ValuesType |
returns form values state object |
errors | ErrorsType |
returns form errors state object |
handleOnChange | HandleOnChangeType |
binds to a HTMLInputElement: change event |
handleOnSubmit | HandleOnSubmitType |
binds to a HTMLFormElement: submit event |
isDisabled | boolean |
returns true / false when the form is valid / invalid |
isSubmitted | boolean |
returns true when the form was submitted without errors |
formModel | FormModelType |
initial form model with optional validation function |
formSubmitCallback | () => void |
function to run after form validation and submission |
!
useForm takes two params: formModel
and formSubmitCallback
and returns the rest.