Vue Fake input is a Vue.js based component to create custom inputs for individual characters.
Type one char per time
or... Paste the entire value
npm install vue-fake-input
or if you prefer yarn
yarn add vue-fake-input
You may install Vue Fake Input globally:
import Vue from 'vue';
import VueFakeInput from 'vue-fake-input';
Vue.use(VueFakeInput);
This will make VueFakeInput available to all components within your Vue app.
Include VueFakeInput directly into your component using import:
import VueFakeInput from 'vue-fake-input';
export default {
...
components: {
VueFakeInput
}
...
};
var VueFakeInput
if (process.browser) {
VueFakeInput = require('vue-fake-input').default
}
export default {
...
components: {
VueFakeInput
}
...
};
<vue-fake-input
:length="5"
:fontSize="40"
inputColor="#31bce6"
fontColor="#ffc107"
:allowPaste="false"
v-model="fullValue"
/>
...
export default {
...
data() {
return {
fullValue: '',
};
}
...
Result:
Property | Type | Required | Default | Description |
---|---|---|---|---|
length | Number | Yes | Length of the input. How many characters it will support (the value is coverted to pixel) | |
fontSize | Number | No | 22 | Font size of the individual characters (the value is coverted to pixel) |
inputColor | String | No | '#42b983' | Color of the border bottom wen the input is filled |
fontColor | String | No | '#42b983' | Color of the individual Characters |
allowPaste | Boolean | No | true | Allow the user to paste values into the input |
onlyNumber | Boolean | No | false | Only allow number input |
This project is licensed under the MIT License - see the LICENSE.md file for details.