@kform/react
Version:
React integration for KForm.
19 lines (18 loc) • 643 B
TypeScript
import { type AbsolutePath, FormManager } from "@kform/core";
import * as React from "react";
import { type FormController } from "../hooks/useForm";
/** Value of the form context. */
export interface FormContextValue<T = unknown> {
/** Form manager in scope. */
formManager: FormManager;
/**
* Current path in context.
*
* Paths provided to e.g. `useController` are relative to this path.
*/
currentPath: AbsolutePath;
/** Controller of the form in scope. */
controller?: FormController<T>;
}
/** Context of a form. */
export declare const FormContext: React.Context<FormContextValue<any> | null>;