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

0.0.32 • Public • Published

Installation

pnpm i @appwise/forms

The validation of this package relies on Zod.

Documentation

Refer to the documentation for a more in depth look.

Usage Example

<script setup lang="ts">
import { useForm } from '@appwise/forms'
import { z } from 'zod'

// Create a schema
const exampleForm = z.object({
  name: z.string().min(1),
  email: z.string().email(),
})

// Parse the schema to `useForm` along with a function to handle the submit.
// Optionally, you can also pass a object to prepare the form.
const form = useForm(exampleForm,
  // Loads the form with initial data
  {
    name: 'Foo',
    email: 'foo@mail.com',
  },
)

// Now you can register fields on the form, which are fully typed.
// These fields will handle the actual data-binding
const name = form.register('name')
</script>

<template>
  <CustomInput v-bind="name" />
  <CustomInput v-bind="form.register('email')" />
</template>

Readme

Keywords

none

Package Sidebar

Install

npm i @appwise/forms

Weekly Downloads

0

Version

0.0.32

License

MIT

Unpacked Size

56.6 kB

Total Files

5

Last publish

Collaborators

  • maartensijmkens
  • jeffreynijs
  • kobe-kwanten-wisemen
  • wouter.appwise
  • jorenvandeweyer