Configuration

Installation Config

You may need to configure some options to tweak some of the plugin internals. This is not required, but could cause conflicts. For example, using a property called errors on your vue instance may cause conflicts. Here is how you would set up the options, along with the default values:

import Vue from 'vue';
import VeeValidate from 'vee-validate';

const config = {
  aria: true,
  classNames: {},
  classes: false,
  delay: 0,
  dictionary: null,
  errorBagName: 'errors', // change if property conflicts
  events: 'input|blur',
  fieldsBagName: 'fields',
  i18n: null, // the vue-i18n plugin instance
  i18nRootKey: 'validations', // the nested key under which the validation messages will be located
  inject: true,
  locale: 'en',
  strict: true,
  validity: false,
};

Vue.use(VeeValidate, config);
PropertyTypeDefaultDescription
ariabooleantrueAllows setting aria-invalid and aria-required attributes on HTML inputs.
classNamesobjectThe classes to be applied depending on the state of the input.
classesbooleanfalseApplies automatic classes on HTML inputs being validated.
delaynumber0The default debounce time for all inputs (only affects validations).
dictionaryobject|nullnullA dictionary to be merged with the internal dictionary. (Check the Error Messages and Localization sections.)
errorBagNamestring'errors'The name of the ErrorBag object that will be injected in each of Vue's instances' data. Used to avoid conflicts with other plugins.
eventsstring'input|blur'Pipe separated list of the default event names that will be listened to, to trigger validation. If an empty string is provided, it will disable all listeners.
fieldsBagNamestring'fields'The name of the Fields (flags) object that will be injected in each of Vue's instances' data.
fastExitbooleantrueWhether the validation should stop after the first failure for each field, you can opt in or out from either settings by using the continues and the bails modifiers.
i18nVueI18n | nullnullThe vue-i18n instance, if provided will integrate vee-validate with the i18n plugin and will use it to produce the error messages instead of the built in dictionary.
i18nRootKeystring'validations'The key name of the validation messages for each locale.
injectbooleantrueSpecifies if a validator instance should be injected automatically for all components. (See Component Injections for more information.)
localestring'en'The default language for the validation messages.
strictbooleantrueValidation attempt on non-existent fields will result in an invalid state
validitybooleanfalseSet custom validity Constraint validation on native HTML inputs.