2.3.3 • Published 2 years ago

form-manager-react v2.3.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

form-manager-react

Overview

A simple lightweight form manager made in React for simple forms wich can be integrated with your css styles and fields validations.
Installation
npm i form-manager-react

Properties

PropDescriptionDefault
onSubmitFunction to handle form data
validationsA set of functions to validate inputs by namenone
formStyleexternal form style{}
styleErrorParagraphexternal style for error display{}
styleErrorDivexternal style for error container{}
classNameErrorDivclassName for error containernone
classNameErrorParagraphclassName for error displaynone
classNameFormclassName for formnone

License

MIT

How to use

import React from 'react'

import Form from 'form-manager-react'

const View: React.FC = () => {
  return (
    <>
      <Form
        onSubmit={data => {
          console.log(data)
        }}
        styleErrorParagraph={{ color: 'red', fontWeight: 'bold' }}
        validations={{
          cpf: text => {
            const regex =
              /^([0-9]{3}\.?[0-9]{3}\.?[0-9]{3}\-?[0-9]{2}|[0-9]{2}\.?[0-9]{3}\.?[0-9]{3}\/?[0-9]{4}\-?[0-9]{2})$/
            return regex.test(String(text))
          },
        }}
      >
        <div>
          <input name="name1" type="text" value="value" />
          <div>
            <input name="cpf" type="text" value="value" />
          </div>
        </div>
        <button
          style={{
            backgroundColor: 'blue',
            color: 'white',
            borderRadius: '16px',
            border: 'none',
            padding: '8px 16px',
          }}
          type="submit"
        >
          Salvar
        </button>
      </Form>
    </>
  )
}

export default View
2.3.3

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.3.0

2 years ago

2.2.9

2 years ago

2.2.8

2 years ago

2.2.7

2 years ago

2.2.6

2 years ago

2.2.5

2 years ago

2.2.4

2 years ago

2.2.3

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

2.1.9

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.1.6

2 years ago

2.1.5

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

0.1.3

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago