A very useful pure javascript library to creating pin code inputs.
Inspired by vue-pincode-input
npm i pincode-input
import PincodeInput from 'pincode-input'
import 'pincode-input/dist/pincode-input.min.css'
<!-- CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/pincode-input.min.css" />
<!-- JS -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/pincode-input.min.js"></script>
<div id="demo"></div>
new PincodeInput('#demo', {
count: 4,
secure: false,
previewDuration: 200,
onInput: (value) => {
console.log(value)
}
})
Name | Type | Default | Description |
---|---|---|---|
count | number | 4 | Count of the cells. |
secure | boolean | false | Set to true to use the inputs with type="password" |
previewDuration | number | 200 | Duration of the character preview. Valid when used with secure: true |
Name | Description |
---|---|
onInput | Returns current value. |