UNPKG

formkit-react

Version:

FormKit is a React library for building forms with ease.

27 lines (26 loc) 971 B
import React from "react"; export type ListenerType = "isFetching" | "isError" | "isDone" | "submitData" | "reset"; interface Props<T extends Record<string, any> = Record<string, any>> { url?: string; action?: "POST" | "PUT" | "DELETE" | "PATCH"; children: React.ReactNode; onSubmit?: (data: T) => void; onSuccess?: (response: any) => void; onError?: (error: any) => void; initalData?: T & Record<string, any>; customFetch?: (data: T) => Promise<any>; submitText?: string; loadingText?: string; formData?: boolean; className?: string; defaultSubmitBtn?: boolean; } type ValidateProps<T extends Record<string, any>> = Props<T> & ({ customFetch: (data: T) => Promise<any>; url?: never; } | { url: string; customFetch?: never; }); export default function FormKit<T extends Record<string, any> = Record<string, any>>({ children, defaultSubmitBtn, ...rest }: ValidateProps<T>): React.JSX.Element; export {};