0.2.2 • Published 2 years ago

@soywod/pin-field v0.2.2

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
2 years ago

📟 PIN Field npm

Native web component for entering PIN codes.

gif

Live demo at https://soywod.github.io/pin-field/demo/.

Installation

From npm

npm install @soywod/pin-field
# or
yarn add @soywod/pin-field

The package is available in both GitHub Packages and npm registries.

From CDN (jsDelivr)

<script type="module" src="https://cdn.jsdelivr.net/npm/@soywod/pin-field/dist/pin-field.esm.js"></script>

Usage

<swd-pin-field></swd-pin-field>

Attributes

NameDescription
lengthNumber of inputs the PIN Field is composed of
validateList of allowed chars

Additional attributes are transfered to all the inputs (except for id).

Properties

NameTypeDescriptionDefault
lengthnumberNumber of inputs the PIN Field is composed of5
validatestring\|string[]\|RegExp\|(key: string) => booleanValidator/^[a-zA-Z0-9]$/
format(key: string) => stringFormatterkey => key

Events

NameDescriptionData
changeTriggered when the PIN code changes{detail: {value: string}}
completeTriggered when the PIN code is complete{detail: {value: string}}
resolveTriggered when a key is resolved{detail: {key: string}}
rejectTriggered when a key is rejected{detail: {key: string}}

Sponsoring

github paypal ko-fi buy-me-a-coffee liberapay

0.2.2

2 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.9

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago