svelte-mask
v0.3.5
Published
The simplest component of an input mask with validation for digits of a given format, which can contain arbitrary non-numeric characters
Downloads
43
Readme
svelte-input-mask
The simplest component of an input mask with validation for digits of a given format, which can contain arbitrary non-numeric characters
Features:
- The minified bundle weighs less than 5kb
- universal validation for any numeric formats
Installation:
npm i svelte-mask
Using inside Svelte app:
<script>
import PhoneMaskInput from 'svelte-mask'
</script>
<PhoneMaskInput originHolder="+1(000)0000000" />
Using inside vanile app:
using modules:
import PhoneMaskInput from 'svelte-mask'
const app = new PhoneMaskInput({
target: document.getElementById('app'),
props: {
originHolder: '+1(000)0000000'
}
})
export default app
using prepared bundle:
<link rel="stylesheet" href="https://unpkg.com/svelte-mask@latest/build/css/app.css">
<div id="app"></div>
<script src="https://unpkg.com/svelte-mask@latest/build/bundle.js"></script>
<script>
createMaskInput('app', '+7(999)9999999')
</script>
PS:
if you found this component useful, you can show it by clicking on the star