@saas-ui/forms
TypeScript icon, indicating that this package has built-in type declarations

2.6.1 • Public • Published

Forms Manager

Powerfull forms library for Chakra UI. Create typesafe React forms with speed.

Supports Zod, Yup and AJV for validation and form generation.

Installation

$ yarn add @saas-ui/forms

#or

$ npm i @saas-ui/forms  --save

Usage with Zod

AutoForm

Generate forms from schema.

import { createZodForm } from '@saas-ui/forms/zod'

const { AutoForm } = createZodForm()

const schema = z.object({
  name: z.string(),
})

function App() {
  const onSubmit = (data: z.infer<typeof schema>) => {}
  return <AutoForm schema={schema} onSubmit={onSubmit} />
}

Form

Create custom typesafe forms.

import { FormLayout, createZodForm } from '@saas-ui/forms/zod'

const { Form, SubmitButton } = createZodForm()

const schema = z.object({
  name: z.string()
})

function App() {
  const onSubmit = (data: z.infer<typeof schema>) => {}

  return (
    <Form schema={schema} onSubmit={onSubmit}>
        {({ Field }) => (
            <FormLayout>
                <Field name="name" type="text" />
                <SubmitButton>Save</SubmitButton>
            </FormLayotu>
        )}
    </Form>
  )
}

Source

https://github.com/saas-js/saas-ui/tree/next/packages/saas-ui-forms

License

MIT - Appulse Software

Package Sidebar

Install

npm i @saas-ui/forms

Homepage

saas-ui.dev/

Weekly Downloads

4,084

Version

2.6.1

License

MIT

Unpacked Size

736 kB

Total Files

78

Last publish

Collaborators

  • eelcow