# formival

> Automatic form generation for Vue

Latest version **0.1.7** (published 2020-10-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install formival
pnpm add formival
yarn add formival
bun add formival
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.7 |
| Published | 2020-10-09 |
| First published | 2020-03-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 358 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Darren Mothersele |
| Maintainers | darrenmothersele |
| Keywords | vue, vue.js, forms, json forms, form library |

## Links

- npm: https://www.npmjs.com/package/formival
- Repository: https://github.com/formival/formival
- Homepage: https://github.com/formival/formival#readme
- Issues: https://github.com/formival/formival/issues
- npm.io page: https://npm.io/package/formival

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.7 (latest) — 2020-10-09
- 0.1.6 — 2020-10-09
- 0.1.4 — 2020-03-06
- 0.1.3 — 2020-03-03
- 0.1.2 — 2020-03-03
- 0.1.1 — 2020-03-03
- 0.1.0 — 2020-03-03

## README

# Formival

[![npm](https://badgen.net/npm/v/formival)](https://www.npmjs.com/package/formival) 
[![size](https://badgen.net/bundlephobia/minzip/formival)](https://bundlephobia.com/result?p=formival)
[![tests](https://badgen.net/travis/formival/formival)](https://travis-ci.org/formival/formival)
[![coverage](https://badgen.net/codecov/c/gh/formival/formival)](https://codecov.io/gh/formival/formival)
[![analysis](https://img.shields.io/scrutinizer/quality/g/formival/formival?style=flat-square)](https://scrutinizer-ci.com/g/formival/formival/)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/00481f2073ed4f77a1653bd397201b49)](https://app.codacy.com/gh/formival/formival)
[![vue2](https://badgen.net/badge/Vue/2.x/green)](https://vuejs.org/)
[![license](https://badgen.net/badge/license/MIT/blue)](http://opensource.org/licenses/MIT)

Automatic form generation for Vue. 
Inspired by Formly, but as idiomatic Vue. 
Making use of the awesome Vuelidate library, rather than re-inventing a new validation solution.

## Installation

```bash
npm install --save formival
```

## Usage

### Bundler (Webpack, Vue CLI, Rollup)

```js
import Vue from 'vue';
import Formival from 'formival';
Vue.use(Formival);
const formival = new Formival({
  // options
});
new Vue({
  formival,
  render: h => h(App),
}).$mount('#app');
```

As options when creating the `Formival` instance, you need to provide
input types, wrappers, and validation messages:

```js
const types = [
  {
    name: 'input',
    component: SimpleInput,
    wrappers: ['field-wrapper']
  }
];

const wrappers = [
  {
    name: 'field-wrapper',
    component: FieldWrapper
  }
];

const validationMessages = {
  required: "{{field.templateOptions.label}} is required",
  email: "{{value}} is not a valid email address"
};

const formival = new Formival({
  types,
  wrappers,
  validationMessages
});
```

Then you can make use of the `formival-form` component to
embed a form anywhere:

```html
<form @submit.prevent="onSubmit" novalidate autocomplete="off">
  <formival-form v-model="model" :validation="$v.model" :fields="fields"/>
  <button type="submit">Submit</button>
</form>
``` 

See the [Docs](https://formival.github.io) and [Examples](https://github.com/formival/formival-examples) repo
for more details on usage.

### Browser

```html
<!-- Include after Vue -->
<!-- Local files -->
<script src="formival/dist/formival.js"></script>

<!-- From CDN -->
<script src="https://unpkg.com/formival"></script>
```

## License

[MIT](http://opensource.org/licenses/MIT)

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