Number input component with prefixes and masks for Svelte 3.
Install with npm or yarn:
npm install --save svelte-number-format
value
- the value of the inputplaceholder
- the placeholder of the input (optional)displayType
- can be text
or input
(by default: input
)prefix
- set characters before the input (optional)mask
- the mask of the input, (example: "+{7}(000)000-00-00") (optional)<script lang="ts">
import NumberFormat from 'svelte-number-format'
let inputValue = ''
$: console.log(inputValue)
</script>
<NumberFormat
mask="+{7}(000)000-00-00"
bind:value="{inputValue}"
displayType="input"
/>
MIT © Pitis Radu