Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Mini-ghost/vorms
Vue Form Validation with Composition API
https://github.com/Mini-ghost/vorms
composition-api form form-validation forms validation vue vuejs3
Last synced: 3 months ago
JSON representation
Vue Form Validation with Composition API
- Host: GitHub
- URL: https://github.com/Mini-ghost/vorms
- Owner: Mini-ghost
- License: mit
- Created: 2022-04-27T16:26:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-04T01:54:03.000Z (8 months ago)
- Last Synced: 2024-04-28T07:12:47.595Z (6 months ago)
- Topics: composition-api, form, form-validation, forms, validation, vue, vuejs3
- Language: TypeScript
- Homepage: https://vorms.mini-ghost.dev
- Size: 717 KB
- Stars: 490
- Watchers: 6
- Forks: 17
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-vue-3 - vorms - Vue Form Validate with Composition API. (Packages)
README
Vue Form Validation with Composition API## Feature
- **Type Strong**: Written in TypeScript, with TSDoc.
- **[Lightweight](https://bundlephobia.com/package/@vorms/core@latest)**: Only 12kb compressed (4kb compressed + gzip compressed) and fully tree-shaking.
- **Easiest**: Vorm uses the [Composition API](https://vuejs.org/guide/extras/composition-api-faq.html) to give you a very seamless development experience.
- **Flexible**: [Yup](https://github.com/jquense/yup), [Zod](https://github.com/colinhacks/zod), [Valibot](https://github.com/fabian-hiller/valibot) and self-def validation are supported.## Install
```bash
npm install @vorms/core
```## CDN
```html
```
It will be exposed to global as `window.Vorms`
## Usage
**setup script**
```ts
import { useForm } from '@vorms/core'const sugarOptions = ['no', 'light', 'half', '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')
```**template**
```html
Drink
Sugar level
{{ item }}
Reset
Submit```
Refer [documentations](https://vorms.mini-ghost.dev/) for more details.
## Examples
- [Login](https://stackblitz.com/edit/vorms-login?file=src%2FApp.vue)
- [Field Array](https://stackblitz.com/edit/vorms-field-array?file=src%2FApp.vue)
- [Cross Field Validate](https://stackblitz.com/edit/vorms-corss-field-validate?file=src%2FApp.vue)
- [Wizard Form](https://stackblitz.com/edit/vorms-wizard-form?file=src%2FApp.vue)
- [Custom Components](https://stackblitz.com/edit/vorms-custom-components?file=src%2FApp.vue)
- [UI Library - Vuetify](https://stackblitz.com/edit/vorms-vuetify?file=src%2FApp.vue)
- [UI Library - Element Plus](https://stackblitz.com/edit/vorms-with-element-plus?file=src%2FApp.vue)
- [Validate With Yup](https://stackblitz.com/edit/vorms-validate-with-yup?file=src%2FApp.vue)
- [Validate With Zod](https://stackblitz.com/edit/vorms-validate-with-zod?file=src%2FApp.vue)## Thanks
This project is heavily inspired by the following awesome projects.
- [Formik](https://github.com/jaredpalmer/formik)
- [React Hook Form](https://github.com/react-hook-form/react-hook-form)
- [VeeValidate](https://github.com/logaretm/vee-validate)## Contributors
Thanks to the wonderful people who have already contributed to Vorms!
Made with [contrib.rocks](https://contrib.rocks).
## License
[MIT License](https://github.com/Mini-ghost/vorms/blob/main/LICENSE) © 2022-PRESENT [Alex Liu](https://github.com/Mini-ghost)