Feature
- Type Strong: Written in TypeScript, with TSDoc.
- Lightweight: Only 12kb compressed (4kb compressed + gzip compressed) and fully tree-shaking.
- Easiest: Vorm uses the Composition API to give you a very seamless development experience.
- Flexible: Yup, Zod, Valibot and self-def validation are supported.
Install
npm install @vorms/core
CDN
<script src="https://unpkg.com/@vorms/core"></script>
It will be exposed to global as window.Vorms
Usage
setup script
import { useForm } from '@vorms/core'
const sugarOptions = ['no', 'light', 'half', 'standard']
const { register, handleSubmit, handleReset } = useForm({
initialValues: {
drink: '',
sugar: 'light',
},
onSubmit(data) {
console.log(data)
}
})
const { value: drink, attrs: drinkFieldAttrs } = register('drink')
const { value: sugar, attrs: sugarFieldAttrs } = register('sugar')
<a href="https://github.com/mini-ghost/vorms/graphs/contributors">
<img src="https://contrib.rocks/image?repo=mini-ghost/vorms" />
</a>