0.0.2 • Published 3 years ago

vue2-dynamic-input-field v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Vue Dynamic Input Field

The most powerful input field you have ever seen.

Features

  • NO dependencies
  • Inline Validation
  • Scoped Styles
  • v-model native support

Installation

npm i vue2-dynamic-input-field

or if you prefer yarn

yarn add vue2-dynamic-input-field

Usage

Global

You may install Vue Dynamic input field globally:

import Vue from 'vue';
import DynamicInputField from 'vue2-dynamic-input-field'

Vue.use(DynamicInputField);

Local

Include the dynamic input field directly into your component using import:

<template>
  <div>
     <DynamicInputField
        placeholder="Enter your username"
        label="Enter username"
        required
        maxlength="250"
        v-model="username"
        error-message="Please enter your username" // Custom error message
        trim // Trim input data
        optional // remove astrik mark from label
        hintText="Please enter your username" // Custom hint text
        type="text"
       >
      </DynamicInputField>
  </div>
</template>

<script>
  import DynamicInputField from 'vue2-dynamic-input-field'

  export default {
    components: { DynamicInputField },
    data () {
      return {
        username: ''
      }
    }
  }
</script>

Props

PropertyTypeDefaultDescription
optionalBooleanfalseMark field as optional
labelStringLabel for input field
hintTextStringOptional hint text
typeStringtextInput field type ( email, tel etc. )
nameStringInput field name
placeholderStringInput field placeholder
valueString, NumberInput field value
maxlengthString, NumberInput field maxlength
maxlengthStringInput field minlength
disabledBooleanfalseDisable input field
trimBoolean, StringfalseRemove extra space from text first/last
numberBoolean, StringfalseOnly allow numbers
error-messageStringfalseShow custom error message to user

Methods

PropertyDescription
@inputOn input change( This handles v-model functionality)
@keypressOn pressing key
@keyupOn keyup
@clearerrorClear all the errors