All Projects → beizhedenglong → vue-hooks-form

beizhedenglong / vue-hooks-form

Licence: MIT license
Building forms with vue composition API.

Programming Languages

typescript
32286 projects
Vue
7211 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to vue-hooks-form

Vue3 News
🔥 Find the latest breaking Vue3、Vue CLI 3+ & Vite News. (2021)
Stars: ✭ 2,416 (+1744.27%)
Mutual labels:  vue-components, vue-composition-api
vui-vc-next
Vue 3 with Vite Playground - Mobile web UI components - (vue3+vite2).
Stars: ✭ 15 (-88.55%)
Mutual labels:  vue-components, vue-composition-api
v-intl
Add i18n to your awesome Vue 3 app 🔉
Stars: ✭ 13 (-90.08%)
Mutual labels:  vue-components, vue-composition-api
vue-virtualised
Blazing fast scrolling and updating for any amount of list and hierarchical data.
Stars: ✭ 18 (-86.26%)
Mutual labels:  vue-components, vue-composition-api
vue-clock-simple
Repo for the article How To Publish Your Vue.js Component On NPM
Stars: ✭ 88 (-32.82%)
Mutual labels:  vue-components
unique-ui
一个用于Vue2.x的移动端组件库
Stars: ✭ 43 (-67.18%)
Mutual labels:  vue-components
vesselize
⛵ A JavaScript IoC container that works seamlessly with Vue.js and React.
Stars: ✭ 22 (-83.21%)
Mutual labels:  vue-composition-api
void-ui
A UI toolkit for Vue.js.
Stars: ✭ 20 (-84.73%)
Mutual labels:  vue-components
vue-on-rails
Easy way to mount/destroy Vue.js components with Ruby on Rails and Turbolinks 5
Stars: ✭ 17 (-87.02%)
Mutual labels:  vue-components
v-owl-carousel
🦉 VueJS wrapper for Owl Carousel
Stars: ✭ 46 (-64.89%)
Mutual labels:  vue-components
vue-flexmonster
Vue Module for Flexmonster Pivot Table & Charts
Stars: ✭ 16 (-87.79%)
Mutual labels:  vue-components
shadow
Shadow dom support for Vue
Stars: ✭ 46 (-64.89%)
Mutual labels:  vue-components
Different-UI
✨ A Vue.js 3 UI Library — a Toy
Stars: ✭ 62 (-52.67%)
Mutual labels:  vue-components
vue-mobiledoc-editor
A lightweight and customizable editor that allows you to embed rich content using Vuejs components.
Stars: ✭ 73 (-44.27%)
Mutual labels:  vue-components
vue-cli-plugin-quasar
Quasar Framework Vue CLI plugin
Stars: ✭ 66 (-49.62%)
Mutual labels:  vue-components
vue-scroll-snap
A super simple Vue component that allows fullscreen and horizontal scroll snapping.
Stars: ✭ 25 (-80.92%)
Mutual labels:  vue-components
vue-data-loading
Another component for infinite scroll and pull down/up to load data.
Stars: ✭ 63 (-51.91%)
Mutual labels:  vue-components
vue-cirrus
Vue components for the Cirrus CSS framework.
Stars: ✭ 43 (-67.18%)
Mutual labels:  vue-components
vstx-data-table
A data table component for the Vue Stacks Ecosystem
Stars: ✭ 34 (-74.05%)
Mutual labels:  vue-components
vue-skeleton-loader
A simple and easily customizable skeleton loader plugin for you Vue application.
Stars: ✭ 74 (-43.51%)
Mutual labels:  vue-components

Vue Hooks Form · license build status Coverage Status

Building forms with Vue composition API.

The API is not stable and might change in the future.

Docs

Visit https://beizhedenglong.github.io/vue-hooks-form/.

Installation

  yarn add vue-hooks-form

Features

  • UI decoupling: Since It does not contain any UI code, It can be easily integrated with other UI libraries.
  • Easy to adoptable: Since form state is inherently local and ephemeral, it can be easily adopted.
  • Easy to use: No fancy stuffs, just reactive values/errors.
  • TypeScript support.

Quickstart

<template>
  <form @submit="onSubmit">
    <label>Username</label>
    <input v-model="username.value" :ref="username.ref" />
    <p v-if="username.error">{{ username.error.message }}</p>
    <label>Password</label>
    <input v-model="password.value" :ref="password.ref" type="password" />
    <p v-if="password.error">{{ password.error.message }}</p>
    <button type="submit">submit</button>
  </form>
</template>

<script>
import { useForm } from 'vue-hooks-form'

export default {
  setup() {
    const { useField, handleSubmit } = useForm({
      defaultValues: {},
    })
    const username = useField('username', {
      rule: { required: true },
    })
    const password = useField('password', {
      rule: {
        required: true,
        min: 6,
        max: 10,
      },
    })
    const onSubmit = (data) => console.log(data)
    return {
      username,
      password,
      onSubmit: handleSubmit(onSubmit),
    }
  },
}
</script>

Live Demo

Edit Vue Hooks Form Demo

API(TODO)

useForm

const {
  values,
  getFieldValues,
  errors,
  validateFields,
  validateField,
  get,
  set,
  useField,
  handleSubmit
} = useForm({
  defaultValues: {},
  shouldUnregister: true,
  validateMode: 'change',
})

useField

const {
 ref,
 value,
 error,
 validate
} = useField(path, options)

Credits

This project was inspired by react-hook-form, formik, and many other form libraries.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].