UNPKG

formik-yup-smartform

Version:

formik-yup-smartform is a lightweight React component that automatically generates forms using Formik and Yup. Just pass a validation schema, field configuration, and submit handler — the form is built for you with validation, error messages, and minimal

26 lines (23 loc) 856 B
import * as react_jsx_runtime from 'react/jsx-runtime'; import * as Yup from 'yup'; type FieldType = "text" | "number" | "email" | "password" | "date" | "checkbox" | "radio" | "file" | "color" | "range" | "tel" | "time"; type Field = { name: string; type: FieldType; label?: string; placeholder?: string; options?: string[]; required?: boolean; }; type Props = { formValues: Field[]; width?: string; formSubmit: (values: Record<string, unknown>) => void; validationSchema?: Yup.ObjectSchema<any>; isLoading?: boolean; buttonBgColor?: string; buttonTextColor?: string; labelTextColor?: string; }; declare const SmartForm: ({ formValues, width, formSubmit, validationSchema, isLoading, buttonBgColor, buttonTextColor, labelTextColor, }: Props) => react_jsx_runtime.JSX.Element; export { SmartForm };