@lynxts/core • Docs
@lynxts/core / FormCtxt
The from context type based on a struct type T
.
• T extends Struct
the struct type of the form values
setTouched:
Dispatch
<SetStateAction
<Map
<GetPath
<T
,unknown
,T
>,boolean
>>>
Changes the touched state of the fields.
either a new touched Map<Path<T>, boolean>
or its equivalent
action callback
setValues:
Dispatch
<SetStateAction
<Partial
<T
>>>
Changes the values T
of the form.
either a new T
object or its equivalent action callback
setViolations:
Dispatch
<SetStateAction
<Map
<GetPath
<T
,unknown
,T
>,string
>>>
Changes the violation state of the fields.
either a new violations Map<Path<T>, string>
or its equivalent
action callback
submit: () =>
void
Submits the form when called.
void
submitted:
boolean
True if the form was submitted before, false otherwise.
touched:
Map
<GetPath
<T
,unknown
,T
>,boolean
>
A Map of the path and a touched state boolean.
validation:
ObjectSchema
<T
,AnyObject
,any
,""
> |ZodType
<T
,ZodTypeDef
,T
> |Adapter
<T
>
The validation schema used by the Form. This may be Yup/Zod schema or a custom Adapter, depending on what was passed to the Form context provider.
values:
Partial
<T
>
The state of the values T
of the form.
violations:
Map
<GetPath
<T
,unknown
,T
>,string
>
A Map of the path and a violation message (if any).