UNPKG

@tiller-ds/formik-elements

Version:

Formik elements module of Tiller Design System

30 lines (29 loc) 1.22 kB
import * as React from "react"; import { FormikConfig } from "formik"; declare type FormikProps<V = any> = { /** * Specifies whether validation should occur after form submission (as opposed to the default on blur validation behavior). * @type {boolean} * @default false */ validateAfterSubmit?: boolean; /** * Specifies whether the form should automatically scroll to the first encountered validation error. * * @type {boolean} * @default false */ scrollToError?: boolean; }; export declare type Status = "idle" | "waiting" | "error" | "success"; declare type FormContainerState = { status: "validation"; errors: object; } | { status: Status; }; declare type FormContainerContext = FormContainerState & FormikProps; declare const FormContainerContext: React.Context<FormContainerContext>; export default function FormContainer<Values, ExtraProps>({ onSubmit: originalOnSubmit, validateAfterSubmit, scrollToError, initialErrors, enableReinitialize, children, ...rest }: FormikConfig<Values> & ExtraProps & FormikProps): JSX.Element; export declare function useFormContainerContext(): FormContainerContext; export {};