@kform/react
Version:
React integration for KForm.
27 lines (26 loc) • 675 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>;