ryanbuening / BlazorInputMask

Blazor Input Mask

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blazor Input Mask

Nuget Package : https://www.nuget.org/packages/BlazorInputMask/

Install-Package BlazorInputMask

Blazor Input Mask (based on https://imask.js.org/)

Use like that:

<EditForm Model="..

<InputMask @bind-Value="user.Telephone" class="form-control" data-mask="00.00.00.00.00" placeholder="Phone No" />

In your _Host.cshtml or Index.html file:

<script src="_content/BlazorInputMask/Main.js"></script>
<script src="_content/BlazorInputMask/IMask.js"></script>

You can also have the possibility to set an id to the mask (optional), and also retrieve the unmasked value.

06-29-2021 : Added parameter - validateOnKeyPress

Additional help in the demo code here :

https://github.com/raphadesa/BlazorInputMask/blob/master/BlazorInputMask/Pages/Index.razor

06-13-2021 : RegEx support

Usage : (RegEx must start and end with a slash '/')

<InputMask @bind-Value="user.Telephone" class="form-control" data-mask="/^\d+$/" placeholder="Phone No" />

About

Blazor Input Mask


Languages

Language:HTML 55.9%Language:C# 23.2%Language:CSS 18.4%Language:JavaScript 2.4%