# Vue Formulate
---------------
[![Build Status](https://travis-ci.org/wearebraid/vue-formulate.svg?branch=master)](https://travis-ci.org/wearebraid/vue-formulate)
[![Current Version](https://img.shields.io/npm/v/vue-formulate.svg)](https://www.npmjs.com/package/vue-formulate)
[![License](https://img.shields.io/github/license/wearebraid/vue-formulate.svg)](https://github.com/wearebraid/vue-formulate/blob/master/LICENSE.txt)
### What is it?
Vue Formulate is a [Vue](https://vuejs.org/) plugin that exposes an elegant
mechanism for building and validating forms with a centralized data store.
### Get Started
#### Download
First download the `vue-formulate` package from npm:
```sh
npm install vue-formulate
```
#### Installation
Install `vue-formulate` like any other vue plugin:
```js
import Vue from 'vue'
import formulate from 'vue-formulate'
Vue.use(formulate)
```
#### Vuex
`vue-formulate` needs to be linked to your vuex store. Vuex can be
configured as a single root store, or as namespaced modules and `vue-formualte`
can work with either setup.
**Vuex Module**
```js
import {formulateModule} from 'vue-formulate'
export default formulateModule('namespace')
```
Using a namespaced vuex module is the recommended installation method. Just be
sure to replace `'namespace'` with the namespace of your vuex module.
Additionally, when using a vuex namespace, you _must_ also pass the namespace
in the Vue plugin installation call:
```js
Vue.use(formulate, {vuexModule: 'namespace'})
```
Alternatively, you can install `vue-formulate`'s store elements to your vuex
root store:
**Root Store**
```js
import Vue from 'vue'
import Vuex from 'vuex'
import {formulateState, formulateGetters, formulateMutations} from 'vue-formulate'
Vue.use(Vuex)
const state = () => ({
// your own state data can live next to vue-formulate's data
your: 'data',
...formulateState()
})
const getters = {
// Your own getters can live next to vue-formulate's getters
yourGetter (state) {
return state.your
},
...formulateGetters()
}
const mutations = {
// Your own mutations can live next to vue-formulate's mutations
setYour (state, payload) {
state.your = payload
},
...formulateMutations()
}
export default new Vuex.Store({
state,
getters,
mutations
})
```
### Usage
`vue-formulate` automatically registers two components `formulate` and
`formulate-element`. These two elements are able to address most of your form
building needs. Here's a simple example:
```html
...more formulate-elements
```
You can think of `` elements a little bit like traditional
`