mui-extended
Version:
Extended UI Components built on Material UI
15 lines (14 loc) • 653 B
TypeScript
export type FormContextType<T extends Record<string, unknown> = Record<string, unknown>> = {
values: T;
touched: Partial<Record<keyof T, boolean>>;
errors: Partial<Record<keyof T, string>>;
isDirty: boolean;
isValid: boolean;
isSubmitting: boolean;
onFieldChange: (name: keyof T, value: T[keyof T]) => void;
onFieldBlur: (name: keyof T) => void;
submit: () => void;
reset: () => void;
};
export declare const FormContext: import("react").Context<FormContextType<Record<string, unknown>>>;
export declare const useFormContext: <T extends Record<string, unknown> = Record<string, unknown>>() => FormContextType<T>;