1.1.0 • Published 2 years ago

formtastisch v1.1.0

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

formtastisch - solid performant forms for React.

  • 🗜 3kb all, treeshakable, depending on usage will be even less.
  • 🚀 Performance guaranteed, controlled inputs with performance of uncontrolled.
  • 🦾 First class typescript support
  • ✅ Zero dependencies
  • ✅ Works with any ui lib, custom inputs, and literally with anything that can return data.
  • ✅ Can be customized and optimized to death. Edgecase friendly and doesn't stand in your way.
  • ✅ First class support for nested data and dynamic forms.
  • ✅ No mess forms code and nice dev experience
const initialData = { firstName: '', lastName: '' }
const formState = makeFormStateWithModel({
  initialData,
  validations: {
    firstName: (value) => validateIsRequired(value),
    lastName: (value) => validateIsRequired(value)
  }
})

export const MyForm: FC = () => {
  formState.use()
  
  return (
    <div>
      <input {...formState.makeInputProps('firstName')} />
      <input {...formState.makeInputProps('lastName')} />
      <p>{JSON.stringify(formState.getData({includeErros: true}))}</p>
      <button
        onClick={() => {
          console.log(formState.validate())
          console.log(formState.isValid())
        }}
      >
        submit
      </button>
    </div>
  )
}

installation

yarn add formtastisch or npm i formtastisch

types included.

examples

All the documented examples as well of examples of API usage you will find in this Sandbox.

API docs

Api documentation

Sandbox app

This repo includes a sandbox with examples, so you can try it out locally.

just cd examplesapp npm i && npm run dev or yarn and yarn dev available on localhost:3000

Examples with source code are in app/examples

1.1.0

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

0.9.8

3 years ago

0.9.9

3 years ago

0.9.71

3 years ago

0.9.7

3 years ago

0.9.61

3 years ago

0.9.6

3 years ago

0.9.5

3 years ago

0.9.43

3 years ago

0.9.42

3 years ago

0.9.41

3 years ago

0.9.4

3 years ago

0.9.38

3 years ago

0.9.37

3 years ago

0.9.36

3 years ago

0.9.35

3 years ago

0.9.34

3 years ago

0.9.32

3 years ago

0.9.31

3 years ago

0.9.3

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.9.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago