Skip to content

Latest commit

 

History

History
143 lines (74 loc) · 3.03 KB

FormCtxt.md

File metadata and controls

143 lines (74 loc) · 3.03 KB

@lynxts/coreDocs


@lynxts/core / FormCtxt

Interface: FormCtxt<T>

The from context type based on a struct type T.

Type Parameters

T extends Struct

the struct type of the form values

Properties

setTouched

setTouched: Dispatch<SetStateAction<Map<GetPath<T, unknown, T>, boolean>>>

Changes the touched state of the fields.

Param

either a new touched Map<Path<T>, boolean> or its equivalent action callback

Defined in

Form.context.ts:137


setValues

setValues: Dispatch<SetStateAction<Partial<T>>>

Changes the values T of the form.

Param

either a new T object or its equivalent action callback

Defined in

Form.context.ts:143


setViolations

setViolations: Dispatch<SetStateAction<Map<GetPath<T, unknown, T>, string>>>

Changes the violation state of the fields.

Param

either a new violations Map<Path<T>, string> or its equivalent action callback

Defined in

Form.context.ts:150


submit()

submit: () => void

Submits the form when called.

Returns

void

Defined in

Form.context.ts:154


submitted

submitted: boolean

True if the form was submitted before, false otherwise.

Defined in

Form.context.ts:158


touched

touched: Map<GetPath<T, unknown, T>, boolean>

A Map of the path and a touched state boolean.

Defined in

Form.context.ts:162


validation

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.

Defined in

Form.context.ts:168


values

values: Partial<T>

The state of the values T of the form.

Defined in

Form.context.ts:172


violations

violations: Map<GetPath<T, unknown, T>, string>

A Map of the path and a violation message (if any).

Defined in

Form.context.ts:176