• Version 2.3.2
  • Published
  • 354 kB
  • 3 dependencies
  • MIT license


npm i formsy-react
yarn add formsy-react
pnpm add formsy-react


A form input builder and validator for React



variable propTypes

const propTypes: {
innerRef: PropTypes.Requireable<(...args: any[]) => any>;
name: PropTypes.Validator<string>;
required: PropTypes.Requireable<string | boolean | object>;
validations: PropTypes.Requireable<string | object>;
value: PropTypes.Requireable<any>;

    variable validationRules

    const validationRules: Validations<any>;


      function addValidationRule

      addValidationRule: <V>(name: string, func: ValidationFunction<V>) => void;

        function withFormsy

        withFormsy: <T, V>(
        WrappedComponent: React.ComponentType<T & WrapperProps<V> & InjectedProps<V>>
        ) => React.ComponentType<Omit<T & WrapperProps<V>, keyof InjectedProps<V>>>;


          class Formsy

          class Formsy extends React.Component<FormsyProps, FormsyState> {}


            constructor(props: FormsyProps);

              property attachToForm

              attachToForm: (component: any) => void;

                property componentDidMount

                componentDidMount: () => void;

                  property componentDidUpdate

                  componentDidUpdate: (prevProps: FormsyProps) => void;

                    property defaultProps

                    static defaultProps: Partial<FormsyProps>;

                      property detachFromForm

                      detachFromForm: <V>(component: InputComponent<V>) => void;

                        property displayName

                        static displayName: string;

                          property emptyArray

                          emptyArray: any[];

                            property getCurrentValues

                            getCurrentValues: () => any;

                              property getModel

                              getModel: () => any;

                                property getPristineValues

                                getPristineValues: () => any;

                                  property inputs

                                  inputs: any[];

                                    property isChanged

                                    isChanged: () => boolean;

                                      property isFormDisabled

                                      isFormDisabled: () => boolean;

                                        property isValidValue

                                        isValidValue: (component: any, value: any) => boolean;

                                          property mapModel

                                          mapModel: (model: IModel) => IModel;

                                            property prevInputNames

                                            prevInputNames: any[];

                                              property propTypes

                                              static propTypes: {
                                              disabled: PropTypes.Requireable<boolean>;
                                              mapping: PropTypes.Requireable<(...args: any[]) => any>;
                                              formElement: PropTypes.Requireable<string | object>;
                                              onChange: PropTypes.Requireable<(...args: any[]) => any>;
                                              onInvalid: PropTypes.Requireable<(...args: any[]) => any>;
                                              onInvalidSubmit: PropTypes.Requireable<(...args: any[]) => any>;
                                              onReset: PropTypes.Requireable<(...args: any[]) => any>;
                                              onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
                                              onValid: PropTypes.Requireable<(...args: any[]) => any>;
                                              onValidSubmit: PropTypes.Requireable<(...args: any[]) => any>;
                                              preventDefaultSubmit: PropTypes.Requireable<boolean>;
                                              preventExternalInvalidation: PropTypes.Requireable<boolean>;
                                              validationErrors: PropTypes.Requireable<object>;

                                                property reset

                                                reset: (model?: IModel) => void;

                                                  property runValidation

                                                  runValidation: <V>(
                                                  component: InputComponent<V>,
                                                  value?: V
                                                  ) => {
                                                  isRequired: boolean;
                                                  isValid: boolean;
                                                  validationError: ValidationError[];

                                                    property setFormPristine

                                                    setFormPristine: (isPristine: boolean) => void;

                                                      property setFormValidState

                                                      setFormValidState: (allIsValid: boolean) => void;

                                                        property setInputValidationErrors

                                                        setInputValidationErrors: (errors: any) => void;

                                                          property submit

                                                          submit: (event?: React.SyntheticEvent<HTMLFormElement>) => void;

                                                            property updateInputsWithError

                                                            updateInputsWithError: IUpdateInputsWithError;

                                                              property updateInputsWithValue

                                                              updateInputsWithValue: IUpdateInputsWithValue<any>;

                                                                property validate

                                                                validate: <V>(component: InputComponent<V>) => void;

                                                                  property validateForm

                                                                  validateForm: () => void;

                                                                    method render

                                                                    render: () => React.FunctionComponentElement<

                                                                      Type Aliases

                                                                      type FormsyInjectedProps

                                                                      type PassDownProps<V> = WrapperProps<V> & InjectedProps<V>;

                                                                        Package Files (4)

                                                                        Dependencies (3)

                                                                        Dev Dependencies (18)

                                                                        Peer Dependencies (2)


                                                                        To add a badge like this badgeto your package's README, use the codes available below.

                                                                        You may also use to create a custom badge linking to

                                                                        • Markdown
                                                                        • HTML
                                                                          <a href=""><img src="" alt=""></a>