# @vorms/core

> Vue Form Validation with Composition API

Latest version **1.1.0** (published 2023-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vorms/core
pnpm add @vorms/core
yarn add @vorms/core
bun add @vorms/core
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-02-25 |
| First published | 2022-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 72.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 720 |
| Author | Alex Liu |
| Maintainers | mini-ghost |
| Keywords | vue, composition-api, form, validate |

## Links

- npm: https://www.npmjs.com/package/@vorms/core
- Repository: https://github.com/mini-ghost/vorms
- Homepage: https://github.com/mini-ghost/vorms#readme
- Issues: https://github.com/mini-ghost/vorms/issues
- npm.io page: https://npm.io/package/@vorms/core

## Dependencies (3)

- [klona](https://npm.io/package/klona.md) ^2.0.6
- [deepmerge](https://npm.io/package/deepmerge.md) ^4.3.0
- [fast-deep-equal](https://npm.io/package/fast-deep-equal.md) ^3.1.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2023-02-25
- 1.2.0-beta.5 (beta) — 2024-03-04
- 1.0.0-rc.2 (rc) — 2022-12-18
- 1.2.0-beta.4 — 2023-08-24
- 1.2.0-beta.3 — 2023-08-07
- 1.2.0-beta.2 — 2023-08-07
- 1.2.0-beta.1 — 2023-06-23
- 1.2.0-beta.0 — 2023-06-23
- 1.0.0 — 2023-01-08
- 1.0.0-rc.1 — 2022-11-19
- 0.0.1-beta.10 — 2022-10-11
- 0.0.1-beta.9 — 2022-10-01
- 0.0.1-beta.8 — 2022-07-15

## README

<p align="center">
<a href="https://github.com/Mini-ghost/vorms"><img src="https://raw.githubusercontent.com/Mini-ghost/vorms/main/docs/public/logo.svg" alt="Vorms - Vue Form Validation with Composition API" width="240">
</a>
<br>
Vue Form Validation with Composition API
</p>

<p align="center">
<a href="https://www.npmjs.com/package/@vorms/core" target="__blank"><img src="https://img.shields.io/npm/v/@vorms/core?color=34A88C&label=" alt="NPM version"></a>
<a href="https://vorms.mini-ghost.dev/" target="__blank"><img src="https://img.shields.io/static/v1?label=&message=docs&color=3D957F" alt="Documentations"></a>
<a href="https://www.npmjs.com/package/@vorms/core" target="__blank"><img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@vorms/core?color=00629E&label="></a>
<br>
<a href="https://github.com//Mini-ghost/vorms" target="__blank"><img alt="GitHub stars" src="https://img.shields.io/github/stars/Mini-ghost/vorms?style=social"></a>
</p>

## 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) and self-def validation are supported.

## Install

```bash
npm install @vorms/core
```

## CDN

```html
<script src="https://unpkg.com/@vorms/core"></script>
```

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
<form @submit="handleSubmit" @reset="handleReset">
  <label>Drink</label>
  <input v-model="drink" type="text" v-bind="drinkFieldAttrs">

  <label>Sugar level</label>
  <select v-model="sugar" v-bind="sugarFieldAttrs">
    <option v-for="item in sugarOptions" :key="item" :value="item">
      {{ item }}
    </option>
  </select>

  <button type="reset">Reset</button>
  <button type="submit">Submit</button>
</form>
```

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!

<a href="https://github.com/mini-ghost/vorms/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=mini-ghost/vorms" />
</a>

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)

---
_Source: https://npm.io/package/@vorms/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
